/* =========================================================
   EMS | SISTEMA INTERNO - ELEGANT DARK & REFINED GOLD THEME
   STYLE.CSS
========================================================= */

:root {
    --preto-fundo: #0b0d11;
    --preto-sidebar: #0e1117;
    --preto-card: #131720;
    --preto-card-hover: #181d28;
    --preto-input: #0f1218;

    /* Dourado Nobre & Confortável (Calibrado com a logo EMS) */
    --dourado: #C8A060;
    --dourado-claro: #d6b37a;
    --dourado-escuro: #a67f40;
    --dourado-hover: #b8904f;
    --dourado-grad: linear-gradient(135deg, #C8A060 0%, #d6b37a 50%, #9e7939 100%);
    --dourado-sombra: 0 4px 18px rgba(200, 160, 96, 0.2);

    --branco: #ffffff;
    --branco-2: #f1f5f9;
    --texto: #f8fafc;
    --texto-2: #94a3b8;
    --texto-muted: #64748b;

    --fundo: #0b0d11;
    --fundo-card: #131720;
    --azul: #ffffff;
    --azul-2: #131720;
    --azul-claro: #C8A060;
    --azul-claro-2: #181d28;

    --borda: rgba(200, 160, 96, 0.18);
    --borda-fina: rgba(255, 255, 255, 0.07);
    --borda-dourada: rgba(200, 160, 96, 0.32);

    --verde: #10b981;
    --amarelo: #f59e0b;
    --vermelho: #ef4444;

    --sombra: 0 10px 30px rgba(0, 0, 0, 0.65);
    --raio: 14px;
}

/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--preto-fundo);
}

body {
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--preto-fundo);
    color: var(--texto);
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

button, input, select, textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

/* =========================================================
   ANIMAÇÃO SHIMMER SEQUENCIAL: SISTEMA INTERNO
========================================================= */

.sidebar-subtitle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1px;
    margin-top: -2px;
    margin-bottom: 22px;
    letter-spacing: .22em;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    user-select: none;
}

.shimmer-letter {
    display: inline-block;
    background: linear-gradient(90deg, #C8A060 0%, #f6e7c8 42%, #fff6dc 50%, #f6e7c8 58%, #C8A060 100%);
    background-size: 320% 100%;
    background-position: 0% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 0 3px rgba(200, 160, 96, 0.35));
    animation: emsShimmer 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.13s);
}

@keyframes emsShimmer {
    0% {
        background-position: 0% 0;
        filter: drop-shadow(0 0 3px rgba(200, 160, 96, 0.35));
        transform: translateY(0);
    }
    45% {
        background-position: 100% 0;
        filter: drop-shadow(0 0 9px rgba(255, 236, 190, 0.9));
        transform: translateY(-1px);
    }
    55% {
        filter: drop-shadow(0 0 12px rgba(255, 244, 214, 0.95));
        transform: translateY(0) scale(1.07);
    }
    100% {
        background-position: 0% 0;
        filter: drop-shadow(0 0 3px rgba(200, 160, 96, 0.35));
        transform: translateY(0);
    }
}

/* =========================================================
   LOGIN
========================================================= */

#loginScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 50% 50%;
    overflow: hidden;
    padding: 0;
    background: #0b0d11;
}

.login-brand-side {
    position: relative;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 72% 5%, rgba(200, 160, 96, 0.14), transparent 35%),
        radial-gradient(circle at 0% 100%, rgba(200, 160, 96, 0.06), transparent 38%),
        #0b0d11;
    color: #ffffff;
    border-right: 1px solid rgba(200, 160, 96, 0.16);
}

.login-brand-content {
    position: relative;
    z-index: 2;
    padding: 60px;
    max-width: 540px;
}

.login-brand-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
}

.login-brand-logo img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.login-brand-name strong {
    display: block;
    font-size: 19px;
    color: #ffffff;
    font-weight: 800;
}

.login-brand-name span {
    display: block;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--dourado);
    font-weight: 700;
}

.login-hero h1 {
    font-size: 38px;
    line-height: 1.15;
    margin-bottom: 18px;
    font-weight: 900;
    color: #ffffff;
}

.login-hero h1 span {
    color: var(--dourado);
}

.login-hero p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--texto-2);
    margin-bottom: 35px;
}

.login-metrics {
    display: flex;
    gap: 25px;
    margin-bottom: 40px;
}

.login-metric strong {
    display: block;
    font-size: 26px;
    color: var(--dourado);
    font-weight: 900;
}

.login-metric span {
    display: block;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--texto-2);
    font-weight: 700;
}

.login-footer {
    font-size: 12px;
    color: var(--texto-muted);
}

.login-form-side {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px;
    background: #0e1117;
}

.login-form-container {
    width: 100%;
    max-width: 420px;
    background: #131720;
    border: 1px solid rgba(200, 160, 96, 0.2);
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

.login-form-header {
    margin-bottom: 26px;
    text-align: center;
}

.login-eyebrow {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #0b0d11;
    background: var(--dourado-grad);
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.login-form-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
}

.login-form-header p {
    font-size: 13px;
    color: var(--texto-2);
    margin-top: 4px;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    stroke: var(--dourado);
    pointer-events: none;
}

.login-input-wrapper input {
    padding-left: 42px !important;
}

.login-button {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--dourado-grad);
    color: #0b0d11;
    font-weight: 800;
    font-size: 14px;
    border: none;
    border-radius: 10px;
    margin-top: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(200, 160, 96, 0.25);
    transition: all .2s ease;
}

.login-button svg {
    width: 18px;
    height: 18px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 160, 96, 0.35);
    filter: brightness(1.05);
}

.login-error {
    font-size: 12px;
    color: var(--vermelho);
    margin-top: 8px;
    display: none;
    text-align: center;
}

.login-help-text {
    font-size: 12px;
    color: var(--texto-muted);
    text-align: center;
    margin-top: 18px;
}

.login-links {
    display: none !important;
}

@media(max-width: 900px) {
    #loginScreen {
        grid-template-columns: 1fr;
    }
    .login-brand-side {
        display: none;
    }
}

/* =========================================================
   SISTEMA INTERNO & SIDEBAR ROLÁVEL COM RODAPÉ TRAVADO
========================================================= */

.system {
    display: flex;
    min-height: 100vh;
    background: var(--preto-fundo);
}

.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    background: #0e1117;
    border-right: 1px solid rgba(200, 160, 96, 0.16);
    display: flex;
    flex-direction: column;
    padding: 22px 12px 18px;
    box-shadow: 6px 0 25px rgba(0, 0, 0, 0.5);
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.sidebar-by {
    display: block;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: .12em;
    text-align: right;
    margin-top: 8px;
    padding-right: 6px;
    color: rgba(200, 160, 96, 0.35);
    cursor: default;
    user-select: none;
    white-space: nowrap;
}

.access-preview {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(200, 160, 96, 0.08);
    border: 1px dashed rgba(200, 160, 96, 0.35);
}

.access-preview.hidden {
    display: none;
}

.login-screen.hidden {
    display: none;
}

html[data-theme="dia"] .access-preview {
    background: rgba(30, 58, 138, 0.05);
    border-color: rgba(30, 58, 138, 0.3);
}

/* FICHA DE DETALHES (botão "Ver") */
.ems-ficha {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ems-ficha-topo {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px dashed rgba(200, 160, 96, 0.25);
}

.ems-ficha-eyebrow {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--dourado);
}

.ems-ficha-nome {
    font-size: 19px;
    font-weight: 800;
    color: var(--texto);
    margin-top: 3px;
}

.ems-ficha-sub {
    font-size: 12px;
    color: var(--texto-2);
    margin-top: 2px;
}

.ems-ficha-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.ems-ficha-badge.badge-aguardando { background: rgba(251, 191, 36, .12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, .35); }
.ems-ficha-badge.badge-andamento { background: rgba(59, 130, 246, .12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, .35); }
.ems-ficha-badge.badge-concluido { background: rgba(16, 185, 129, .12); color: #10b981; border: 1px solid rgba(16, 185, 129, .35); }
.ems-ficha-badge.badge-cancelado { background: rgba(239, 68, 68, .12); color: #f87171; border: 1px solid rgba(239, 68, 68, .35); }

.ems-ficha-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.ems-ficha-campo {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 10px 12px;
}

.ems-ficha-campo label,
.ems-ficha-bloco label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--dourado);
    font-weight: 700;
    margin-bottom: 4px;
}

.ems-ficha-campo span {
    font-size: 13px;
    color: var(--texto);
    word-break: break-word;
}

.ems-ficha-destaque {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.07);
}

.ems-ficha-destaque span {
    font-weight: 800;
    color: var(--dourado);
    font-size: 15px;
}

.ems-ficha-bloco {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid var(--dourado);
    border-radius: 10px;
    padding: 12px 14px;
}

.ems-ficha-bloco p {
    font-size: 13px;
    color: var(--texto);
    line-height: 1.5;
    margin: 0;
}

.service-view-services {
    border: 1px solid rgba(200, 160, 96, 0.18);
    background: rgba(200, 160, 96, 0.04);
    border-radius: 12px;
    padding: 14px;
}

.service-view-services > p {
    margin: 0 0 10px;
}

.service-view-services > p strong {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--dourado);
}

.service-view-service-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.service-view-service-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 12px;
}

.service-view-service-item span {
    font-size: 13px;
    color: var(--texto);
}

.service-view-service-item strong {
    font-size: 13px;
    color: var(--dourado);
}

html[data-theme="dia"] .ems-ficha-campo,
html[data-theme="dia"] .ems-ficha-bloco,
html[data-theme="dia"] .service-view-service-item {
    background: #ffffff;
    border-color: rgba(30, 58, 138, 0.15);
}

html[data-theme="dia"] .service-view-services {
    background: rgba(30, 58, 138, 0.04);
    border-color: rgba(30, 58, 138, 0.2);
}

.sidebar-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

/* A área de navegação rola suavemente enquanto o topo e rodapé ficam travados */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 12px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(200, 160, 96, 0.2);
    border-radius: 4px;
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 13px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--texto-2);
    font-size: 13px;
    font-weight: 600;
    transition: all .2s ease;
    text-align: left;
    flex-shrink: 0;
}

.menu-icon {
    font-size: 15px;
    color: var(--dourado);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.menu-item:hover {
    background: rgba(200, 160, 96, 0.08);
    color: #ffffff;
    border-color: rgba(200, 160, 96, 0.18);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(200, 160, 96, 0.18), rgba(200, 160, 96, 0.06));
    border: 1px solid rgba(200, 160, 96, 0.35);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(200, 160, 96, 0.12);
}

.menu-item.active .menu-icon {
    color: var(--dourado-claro);
    text-shadow: 0 0 6px rgba(200, 160, 96, 0.5);
}

/* RODAPÉ DA SIDEBAR: AJUDA E CONFIGURAÇÕES TRAVADOS NA BASE */
.sidebar-settings {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #0e1117;
}

/* =========================================================
   MAIN CONTENT & HEADER
========================================================= */

.main-content {
    margin-left: 250px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--preto-fundo);
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 90;
    height: 64px;
    background: rgba(14, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(200, 160, 96, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title {
    font-size: 18px;
    font-weight: 800;
    color: #ffffff;
}

/* USUÁRIO & FOTO DE PERFIL NO HEADER */
.user-profile-container {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(200, 160, 96, 0.2);
    cursor: pointer;
    transition: all .2s ease;
    user-select: none;
}

.user-profile:hover {
    background: rgba(200, 160, 96, 0.08);
    border-color: var(--dourado);
}

.user-avatar-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--dourado-grad);
    color: #0b0d11;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    border: 1px solid rgba(200, 160, 96, 0.4);
    box-shadow: 0 0 8px rgba(200, 160, 96, 0.25);
}

.top-user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--dourado);
}

.user-info strong {
    display: block;
    font-size: 13px;
    color: #ffffff;
    font-weight: 700;
}

.user-info span {
    display: block;
    font-size: 11px;
    color: var(--dourado);
    font-weight: 600;
}

.profile-dropdown-arrow {
    font-size: 10px;
    color: var(--dourado);
    margin-left: 2px;
}

/* DROPDOWN DO PERFIL */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: #131720;
    border: 1px solid rgba(200, 160, 96, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 200;
    padding: 8px;
}

.profile-dropdown.hidden {
    display: none !important;
}

.profile-dropdown-header {
    padding: 8px 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 6px;
}

.profile-dropdown-header strong {
    display: block;
    font-size: 13px;
    color: #ffffff;
}

.profile-dropdown-header span {
    display: block;
    font-size: 11px;
    color: var(--dourado);
}

.profile-dropdown-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--texto-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-align: left;
}

.profile-dropdown-item:hover {
    background: rgba(200, 160, 96, 0.1);
    color: #ffffff;
}

.profile-dropdown-item.danger {
    color: #f87171;
}

.profile-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ffffff;
}

.pages-container {
    padding: 32px;
    flex: 1;
}

.page {
    display: block;
    animation: fadeIn .2s ease-out;
}

.page.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   BUTTONS
========================================================= */

.primary-button, .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--dourado-grad);
    color: #0b0d11;
    font-weight: 800;
    font-size: 13px;
    border: none;
    border-radius: 9px;
    padding: 10px 18px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(200, 160, 96, 0.2);
    transition: all .2s ease;
}

.primary-button:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(200, 160, 96, 0.3);
    filter: brightness(1.04);
}

.secondary-button, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #131720;
    border: 1px solid rgba(200, 160, 96, 0.22);
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    border-radius: 9px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all .2s ease;
}

.secondary-button:hover, .btn-secondary:hover {
    border-color: var(--dourado);
    background: rgba(200, 160, 96, 0.1);
    color: #ffffff;
}

.secondary-button.danger, .btn-small.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.secondary-button.danger:hover, .btn-small.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
}

.btn-small {
    padding: 6px 11px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    background: #181d28;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: all .15s ease;
}

.btn-small:hover {
    border-color: var(--dourado);
    background: rgba(200, 160, 96, 0.15);
}

/* =========================================================
   CARDS & CONTAINERS
========================================================= */

.content-card, .table-card, .stat-card, .welcome-card {
    background: #131720;
    border: 1px solid rgba(200, 160, 96, 0.18);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 24px;
    margin-bottom: 24px;
}

.welcome-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: radial-gradient(circle at 100% 0%, rgba(200, 160, 96, 0.1), transparent 45%), #131720;
    border: 1px solid rgba(200, 160, 96, 0.25);
}

.welcome-card h1 {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    margin: 4px 0 6px;
}

.welcome-card p {
    color: var(--texto-2);
    font-size: 13px;
}

.welcome-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.section-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--dourado);
    margin-bottom: 4px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 900;
    color: #ffffff;
}

.page-description {
    color: var(--texto-2);
    font-size: 13px;
    margin-top: 4px;
}

/* =========================================================
   INPUTS & FORMS
========================================================= */

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    background: #0f1218 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 9px;
    padding: 10px 14px;
    color: #ffffff !important;
    font-size: 13px;
    outline: none;
    transition: all .2s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--dourado) !important;
    box-shadow: 0 0 0 3px rgba(200, 160, 96, 0.18) !important;
}

input::placeholder, textarea::placeholder {
    color: var(--texto-muted);
}

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

@media(max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   TABLES
========================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

th {
    padding: 14px 16px;
    background: #0e1117;
    color: var(--dourado);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
    border-bottom: 1px solid rgba(200, 160, 96, 0.22);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* =========================================================
   BADGES & PROGRESS
========================================================= */

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(200, 160, 96, 0.15);
    color: var(--dourado);
    border: 1px solid rgba(200, 160, 96, 0.3);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.progress-value {
    height: 100%;
    background: var(--dourado-grad);
}

/* =========================================================
   MODALS
========================================================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none !important;
}

.modal-container {
    background: #131720;
    border: 1px solid rgba(200, 160, 96, 0.3);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    animation: modalPop .2s ease-out;
}

.modal-container.large-modal {
    max-width: 880px;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
}

.modal-header p {
    font-size: 12px;
    color: var(--texto-2);
    margin-top: 3px;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--texto-2);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 18px;
}

/* =========================================================
   TABS & PANELS
========================================================= */

.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    overflow-x: auto;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--texto-2);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #ffffff;
    border-color: var(--dourado);
}

.tab-btn.active {
    background: rgba(200, 160, 96, 0.15);
    border-color: var(--dourado);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(200, 160, 96, 0.12);
}

.hidden-panel {
    display: none !important;
}

/* =========================================================
   RESPONSIVO
========================================================= */

@media(max-width: 850px) {
    .sidebar {
        width: 70px;
        padding: 16px 8px;
    }
    .sidebar-logo img {
        width: 44px;
        height: 44px;
    }
    .sidebar-subtitle, .menu-item span:not(.menu-icon) {
        display: none !important;
    }
    .menu-item {
        justify-content: center;
        padding: 12px 0;
    }
    .main-content {
        margin-left: 70px;
    }
    .top-bar {
        padding: 0 16px;
    }
    .pages-container {
        padding: 16px;
    }
}

/* =========================================================
   BOTÃO ALTERNAR TEMA (TOPO, AO LADO DO PERFIL)
========================================================= */

.theme-toggle-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(200, 160, 96, 0.25);
    cursor: pointer;
    transition: all .2s ease;
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: rgba(200, 160, 96, 0.12);
    border-color: var(--dourado);
    transform: translateY(-1px);
}

/* =========================================================
   MODO DIA (TEMA CLARO) — html[data-theme="dia"]
   O modo noite (atual) continua igual: basta não ter data-theme.
========================================================= */

html[data-theme="dia"] {
    --preto-fundo: #eef1f6;
    --preto-card: #ffffff;
    --preto-card-hover: #f6f8fc;
    --preto-input: #ffffff;
    --fundo: #eef1f6;
    --fundo-card: #ffffff;
    --texto: #0f172a;
    --texto-2: #475569;
    --texto-muted: #64748b;
    --branco-2: #1e293b;
    --borda: rgba(30, 64, 175, 0.16);
    --borda-fina: rgba(15, 23, 42, 0.10);
    --borda-dourada: rgba(200, 160, 96, 0.45);
    --sombra: 0 10px 26px rgba(15, 23, 42, 0.07);
}

/* Fundo e áreas principais claras */
html[data-theme="dia"] body,
html[data-theme="dia"] .main-content {
    background: var(--preto-fundo);
}

html[data-theme="dia"] .top-bar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

html[data-theme="dia"] .page-title,
html[data-theme="dia"] .user-info strong,
html[data-theme="dia"] .user-info span {
    color: #0f172a;
}

/* Cartões, tabelas e containers */
html[data-theme="dia"] .content-card,
html[data-theme="dia"] .table-card,
html[data-theme="dia"] .stat-card,
html[data-theme="dia"] .welcome-card,
html[data-theme="dia"] .modal-container,
html[data-theme="dia"] .profile-dropdown,
html[data-theme="dia"] .secondary-button,
html[data-theme="dia"] .btn-secondary,
html[data-theme="dia"] .btn-small {
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

html[data-theme="dia"] .welcome-card {
    background: radial-gradient(circle at 100% 0%, rgba(200, 160, 96, 0.12), transparent 45%), #ffffff;
}

html[data-theme="dia"] .welcome-card h1,
html[data-theme="dia"] .page-header h1,
html[data-theme="dia"] .modal-header h2,
html[data-theme="dia"] .input-group label {
    color: #0f172a;
}

html[data-theme="dia"] .secondary-button,
html[data-theme="dia"] .btn-secondary,
html[data-theme="dia"] .btn-small {
    border-color: rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

html[data-theme="dia"] .secondary-button:hover,
html[data-theme="dia"] .btn-secondary:hover {
    background: rgba(200, 160, 96, 0.14);
    color: #0f172a;
}

html[data-theme="dia"] .secondary-button.danger,
html[data-theme="dia"] .btn-small.danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

html[data-theme="dia"] .secondary-button.danger:hover,
html[data-theme="dia"] .btn-small.danger:hover {
    color: #ffffff;
}

/* Inputs e formulários */
html[data-theme="dia"] input,
html[data-theme="dia"] select,
html[data-theme="dia"] textarea {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
    color: #0f172a !important;
}

html[data-theme="dia"] input::placeholder,
html[data-theme="dia"] textarea::placeholder {
    color: #64748b;
}

/* Tabelas */
html[data-theme="dia"] th {
    background: #f1f5f9;
    border-bottom-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="dia"] td {
    color: #0f172a;
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="dia"] tr:hover td {
    background: rgba(15, 23, 42, 0.03);
}

/* Dropdown do perfil */
html[data-theme="dia"] .profile-dropdown {
    border-color: rgba(15, 23, 42, 0.16);
}

html[data-theme="dia"] .profile-dropdown-header {
    border-bottom-color: rgba(15, 23, 42, 0.10);
}

html[data-theme="dia"] .profile-dropdown-header strong {
    color: #0f172a;
}

html[data-theme="dia"] .profile-dropdown-item:hover {
    background: rgba(200, 160, 96, 0.16);
    color: #0f172a;
}

html[data-theme="dia"] .profile-dropdown-item.danger,
html[data-theme="dia"] .profile-dropdown-item.danger:hover {
    color: #dc2626;
}

/* Usuário / avatar no topo */
html[data-theme="dia"] .user-profile {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(15, 23, 42, 0.14);
}

html[data-theme="dia"] .user-profile:hover {
    background: rgba(200, 160, 96, 0.14);
}

/* Modais */
html[data-theme="dia"] .modal {
    background: rgba(15, 23, 42, 0.55);
}

html[data-theme="dia"] .modal-close {
    color: #475569;
}

html[data-theme="dia"] .modal-header,
html[data-theme="dia"] .modal-actions {
    border-color: rgba(15, 23, 42, 0.10);
}

/* ABAS: AZUL DA COR DA LOGO, com letras brancas.
   Ao abrir uma aba, o conteúdo fica com fundo branco. */
html[data-theme="dia"] .tab-nav {
    border-bottom-color: rgba(30, 64, 175, 0.28);
}

html[data-theme="dia"] .tab-btn {
    background: #ffffff;
    border-color: rgba(30, 64, 175, 0.28);
    color: #1e40af;
}

html[data-theme="dia"] .tab-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: #2563eb;
    color: #1e3a8a;
}

html[data-theme="dia"] .tab-btn.active {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    border-color: #1e40af;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

/* Botão de tema no modo dia */
html[data-theme="dia"] .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(30, 64, 175, 0.3);
}

html[data-theme="dia"] .theme-toggle-btn:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: #2563eb;
}

/* LOGIN permanece sempre escuro/corporativo (modo dia não afeta) */
html[data-theme="dia"] #loginScreen,
html[data-theme="dia"] .login-brand-side,
html[data-theme="dia"] .login-form-side {
    background: #0b0d11;
}

html[data-theme="dia"] #loginScreen,
html[data-theme="dia"] #loginScreen h1,
html[data-theme="dia"] #loginScreen h2,
html[data-theme="dia"] #loginScreen h3,
html[data-theme="dia"] #loginScreen p,
html[data-theme="dia"] #loginScreen span,
html[data-theme="dia"] #loginScreen strong,
html[data-theme="dia"] #loginScreen label,
html[data-theme="dia"] #loginScreen a,
html[data-theme="dia"] #loginScreen .login-text {
    color: #ffffff;
}

html[data-theme="dia"] #loginScreen input {
    background: #0f1218 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

/* Letreiro da sidebar continua dourado nas duas cores */
html[data-theme="dia"] .sidebar-subtitle {
    color: inherit;
}

/* Sidebar continua escura no modo dia (texto claro preservado) */
html[data-theme="dia"] .sidebar {
    background: #0e1117;
    border-right: 1px solid rgba(200, 160, 96, 0.16);
}

html[data-theme="dia"] .sidebar-settings,
html[data-theme="dia"] .sidebar-settings .menu-item {
    background: #0e1117;
}

html[data-theme="dia"] .menu-item {
    color: #94a3b8;
}

html[data-theme="dia"] .menu-item:hover,
html[data-theme="dia"] .menu-item.active {
    color: #ffffff;
}

/* =========================================================
   NOTIFICAÇÕES NA TELA (TOAST) — substituem o alert()
========================================================= */

#ems-toasts {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 36px));
    pointer-events: none;
}

.ems-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 15px;
    border-radius: 12px;
    background: #141922;
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    animation: emsToastEntrar .28s ease-out;
    cursor: pointer;
}

.ems-toast.saindo {
    animation: emsToastSair .28s ease-in forwards;
}

.ems-toast-icone {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 900;
    font-size: 13px;
}

.ems-toast .ems-toast-conteudo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ems-toast .ems-toast-conteudo strong {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.ems-toast .ems-toast-conteudo > span {
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}

.ems-toast.sucesso {
    border-color: rgba(16, 185, 129, 0.45);
}
.ems-toast.sucesso .ems-toast-icone {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
}
.ems-toast.sucesso strong {
    color: #10b981;
}

.ems-toast.erro {
    border-color: rgba(239, 68, 68, 0.45);
}
.ems-toast.erro .ems-toast-icone {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}
.ems-toast.erro strong {
    color: #ef4444;
}

.ems-toast.aviso {
    border-color: rgba(245, 158, 11, 0.45);
}
.ems-toast.aviso .ems-toast-icone {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
}
.ems-toast.aviso strong {
    color: #f59e0b;
}

.ems-toast.info {
    border-color: rgba(59, 130, 246, 0.45);
}
.ems-toast.info .ems-toast-icone {
    background: rgba(59, 130, 246, 0.18);
    color: #3b82f6;
}
.ems-toast.info strong {
    color: #3b82f6;
}

@keyframes emsToastEntrar {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes emsToastSair {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* =========================================================
   DIÁLOGO / FORMULÁRIO NO APP — substituem confirm() e prompt()
========================================================= */

.ems-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(4, 6, 10, 0.65);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    transition: opacity .22s ease;
}

.ems-overlay.visivel {
    opacity: 1;
}

.ems-dialog {
    width: 100%;
    max-width: 430px;
    background: #141922;
    border: 1px solid rgba(200, 160, 96, 0.28);
    border-radius: 16px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(12px) scale(.97);
    transition: transform .22s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ems-overlay.visivel .ems-dialog {
    transform: translateY(0) scale(1);
}

.ems-form-dialog {
    max-width: 520px;
}

.ems-dialog-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.ems-dialog-topo h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
}

.ems-dialog-x {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color .2s ease;
}

.ems-dialog-x:hover {
    color: #ffffff;
}

.ems-dialog-corpo {
    padding: 18px;
}

.ems-dialog-corpo p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.88);
    white-space: pre-line;
}

.ems-dialog-botoes {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.ems-form-campo {
    margin-bottom: 14px;
}

.ems-form-campo:last-child {
    margin-bottom: 0;
}

.ems-form-campo label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
    letter-spacing: .2px;
}

.ems-form-campo .ems-obrigatorio {
    color: #ef4444;
}

.ems-form-campo input,
.ems-form-campo select,
.ems-form-campo textarea {
    width: 100%;
    background: #0f1218;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: #ffffff;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
    box-sizing: border-box;
}

.ems-form-campo input:focus,
.ems-form-campo select:focus,
.ems-form-campo textarea:focus {
    border-color: var(--dourado);
    box-shadow: 0 0 0 3px rgba(200, 160, 96, 0.15);
}

.ems-form-campo textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* MODO DIA */
html[data-theme="dia"] .ems-dialog {
    background: #ffffff;
    border-color: rgba(30, 64, 175, 0.28);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
}

html[data-theme="dia"] .ems-dialog-topo {
    border-bottom-color: rgba(15, 23, 42, 0.10);
}

html[data-theme="dia"] .ems-dialog-topo h3 {
    color: #0f172a;
}

html[data-theme="dia"] .ems-dialog-x {
    color: #475569;
}

html[data-theme="dia"] .ems-dialog-x:hover {
    color: #0f172a;
}

html[data-theme="dia"] .ems-dialog-corpo p {
    color: #1e293b;
}

html[data-theme="dia"] .ems-dialog-botoes {
    border-top-color: rgba(15, 23, 42, 0.10);
}

html[data-theme="dia"] .ems-form-campo label {
    color: #0f172a;
}

html[data-theme="dia"] .ems-form-campo input,
html[data-theme="dia"] .ems-form-campo select,
html[data-theme="dia"] .ems-form-campo textarea {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

html[data-theme="dia"] .ems-toast {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
}

html[data-theme="dia"] .ems-toast .ems-toast-conteudo > span {
    color: #334155;
}

/* =========================================================
   ANIMAÇÕES PRÓPRIAS DO SISTEMA (V4)
   Identidade sóbria de ferramenta: página entra com leve
   deslize, métricas em cascata, ícone de menu ativo pulsando,
   barra de progresso com brilho. (Diferente dos planos.)
========================================================= */

@-webkit-keyframes v4Sobe {
    from { opacity: 0; -webkit-transform: translateY(14px); transform: translateY(14px); }
    to { opacity: 1; -webkit-transform: none; transform: none; }
}
@keyframes v4Sobe {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
@keyframes v4Pop {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: none; }
}
@keyframes v4Brilho {
    50% { -webkit-transform: translateX(100%); transform: translateX(100%); }
}

/* Login: entrada em cascata (só na abertura) */
.login-brand-content > * {
    -webkit-animation: v4Sobe .6s ease both;
    animation: v4Sobe .6s ease both;
}
.login-brand-content > *:nth-child(2) { -webkit-animation-delay: .12s; animation-delay: .12s; }
.login-brand-content > *:nth-child(3) { -webkit-animation-delay: .24s; animation-delay: .24s; }
.login-brand-content > *:nth-child(4) { -webkit-animation-delay: .36s; animation-delay: .36s; }
.login-form-container {
    -webkit-animation: v4Sobe .6s ease .15s both;
    animation: v4Sobe .6s ease .15s both;
}

/* Cada página entra com um leve deslize ao trocar de menu */
.page.active {
    -webkit-animation: v4Sobe .3s ease;
    animation: v4Sobe .3s ease;
}

/* Métricas do dashboard sobem em cascata */
.page.active .stat-card {
    -webkit-animation: v4Pop .42s ease both;
    animation: v4Pop .42s ease both;
}
.page.active .stat-card:nth-child(2) { -webkit-animation-delay: .07s; animation-delay: .07s; }
.page.active .stat-card:nth-child(3) { -webkit-animation-delay: .14s; animation-delay: .14s; }
.page.active .stat-card:nth-child(4) { -webkit-animation-delay: .21s; animation-delay: .21s; }

.page.active .welcome-card,
.page.active .page-header {
    -webkit-animation: v4Sobe .35s ease both;
    animation: v4Sobe .35s ease both;
}

.page.active .content-card {
    -webkit-animation: v4Sobe .4s ease .12s both;
    animation: v4Sobe .4s ease .12s both;
}

/* Botão do menu: ícone acompanha o hover */
.menu-icon {
    transition: transform .2s ease;
}
.menu-item:hover .menu-icon {
    -webkit-transform: translateX(3px) scale(1.1);
    transform: translateX(3px) scale(1.1);
}
.menu-item.active .menu-icon {
    -webkit-animation: v4IconPulso 2.4s ease-in-out infinite;
    animation: v4IconPulso 2.4s ease-in-out infinite;
}
@keyframes v4IconPulso {
    0%, 100% { -webkit-transform: scale(1); transform: scale(1); }
    50% { -webkit-transform: scale(1.18); transform: scale(1.18); }
}

/* Barra de progresso com brilho varrendo */
.progress-value {
    position: relative;
    overflow: hidden;
}
.progress-value::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
    -webkit-animation: v4Brilho 3s ease infinite;
    animation: v4Brilho 3s ease infinite;
}

/* =========================================================
   MOBILE — navegação inferior, legível e tátil
   (sidebar vira uma barra de ícones fixa embaixo)
========================================================= */

html, body {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 620px) {

    .sidebar {
        width: 100%;
        height: auto;
        top: auto;
        bottom: 0;
        left: 0;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
        border-right: 0;
        border-top: 1px solid rgba(200, 160, 96, 0.18);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
    }

    .sidebar-logo {
        display: none;
    }

    .sidebar-menu {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        min-height: 0;
        margin-bottom: 0;
        padding-right: 0;
        overflow-x: auto;
        overflow-y: visible;
        flex: 1;
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    .sidebar-settings {
        flex-direction: row;
        align-items: center;
        gap: 4px;
        margin-top: 0;
        padding: 0 0 0 6px;
        border-top: 0;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        background: transparent;
        flex-shrink: 0;
    }

    .menu-item {
        width: auto;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .menu-item .menu-icon {
        width: auto;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: 78px;
    }

    .top-bar {
        height: 60px;
        padding: 0 14px;
    }

    .page-title {
        font-size: 15px;
    }

    .user-info {
        display: none;
    }

    .pages-container {
        padding: 14px 12px 24px;
    }

    .content-card, .stat-card, .welcome-card {
        padding: 18px 16px;
    }

    .table-card {
        padding: 0;
    }

    th, td {
        padding: 10px 10px;
    }

    .stat-card strong {
        font-size: 22px !important;
    }

    /* Grade das métricas do dashboard: 2 colunas compactas */
    body .main-content .page > div[style*="minmax(220px"] {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .welcome-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .welcome-actions .primary-button,
    .welcome-actions .secondary-button {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
    }

    .primary-button, .secondary-button {
        width: 100%;
    }

    .modal {
        padding: 12px;
    }

    .modal-container {
        padding: 20px 16px;
    }

    /* 16px nos campos evita o zoom automático do iOS */
    .input-group input,
    .input-group select,
    .input-group textarea {
        font-size: 16px;
    }

}

/* =========================================================
   SERVIÇOS DO ATENDIMENTO (LINHAS)
========================================================= */

.service-item-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.service-item-row .service-item-select {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--texto);
    font-size: 13px;
    outline: none;
}

.service-item-row .service-item-value {
    width: 120px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--texto);
    font-size: 13px;
    text-align: right;
    outline: none;
}

.service-item-row .service-item-value[readonly] {
    opacity: .55;
}

.service-free-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.service-free-bar input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--texto);
    font-size: 13px;
    outline: none;
}

html[data-theme="dia"] .service-item-row .service-item-select,
html[data-theme="dia"] .service-item-row .service-item-value,
html[data-theme="dia"] .service-free-bar input {
    background: #ffffff;
    border-color: rgba(30, 58, 138, 0.15);
    color: #1e3a8a;
}
