:root {
    --bg-body: #F4F6F8;
    --bg-form: #ffffff;
    --bg-header: #2C3E50;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --accent-primary: #3B82F6;
    --accent-secondary: #10B981;
    --border-color: #E5E7EB;
    --bg-input: #F9FAFB;
    --text-btn: #ffffff;
    --danger: #ea4335;
    --warning: #fbbc04;
}
::selection{
    background: var(--accent-secondary);
    color: var(--text-main);
}

/* --- TEMAS (TODOS RESTAURADOS) --- */
[data-theme="papyrus"] {
    --bg-body: #F4F1EA;
    --bg-form: #FCFAEF;
    --bg-header: #2A7A7A;
    --text-main: #33281E;
    --text-muted: #73685E;
    --accent-primary: #C15C3D;
    --accent-secondary: #4A8C54;
    --border-color: #D6D1C4;
    --bg-input: #E8E4D8;
}

[data-theme="marble"] {
    --bg-body: #FCF8F8;
    --bg-form: #ffffff;
    --bg-header: #5D3A4B;
    --text-main: #2A1B22;
    --text-muted: #826673;
    --accent-primary: #B89947;
    --accent-secondary: #6A7B6B;
    --border-color: #EADCE0;
    --bg-input: #F5EBEF;
}

[data-theme="sepia"] {
    --bg-body: #1E1A17;
    --bg-form: #2A2421;
    --bg-header: #14110F;
    --text-main: #E8E3D9;
    --text-muted: #A39B8F;
    --accent-primary: #A65E44;
    --accent-secondary: #6B5542;
    --border-color: #403631;
    --bg-input: #1A1614;
}

[data-theme="byzantine"] {
    --bg-body: #1A1B26;
    --bg-form: #232534;
    --bg-header: #10111A;
    --text-main: #D5D6DB;
    --text-muted: #848CB5;
    --accent-primary: #C5A059;
    --accent-secondary: #6A4B75;
    --border-color: #35384E;
    --bg-input: #15161E;
}

[data-theme="patina"] {
    --bg-body: #1C2221;
    --bg-form: #252E2C;
    --bg-header: #111615;
    --text-main: #D1DDD8;
    --text-muted: #89A098;
    --accent-primary: #5B9279;
    --accent-secondary: #877457;
    --border-color: #384542;
    --bg-input: #141817;
}

/* Classe para impedir seleção de texto em elementos de interface */
.no-select {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10 e 11 */
    user-select: none;         /* Padrão moderno */
    outline: none;             /* Remove o contorno azul ao clicar */
    -webkit-tap-highlight-color: transparent; /* Remove o flash azul no Android/iOS */
}
/* Blindagem específica para Inputs e Selects */

input, select, textarea {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    transition: 0.3s;
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border: 2px solid var(--border-color) !important;
    -webkit-text-fill-color: var(--text-main) !important;
}

/* Garante que o texto digitado seja visível mesmo com preenchimento automático */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html {
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* LAYOUT GERAL */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- HEADER --- */
.header {
    background: var(--bg-header);
    color: white;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: background-color 0.5s ease;
}
.logo-hecar {
  width: 400px; 
  height: 400px;
  object-fit: cover; /* Garante que a imagem não fique esticada */
}

.menu-icon {
    font-size: 28px;
    cursor: pointer;
    margin-right: 15px;
    transition: transform 0.2s;
}

.menu-icon:active {
    transform: scale(0.9);
}

.app-title {
    font-weight: 800;
    font-size: 18px;
    flex-grow: 1;
    letter-spacing: 0.5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Botão Tema */
.btn-theme {
    display: block;
    width: 100%;
    text-align: left;
    padding: 15px;
    margin-bottom: 10px;
   	border-radius: 15px;
    border: 1px solid var(--border-color) !important;
    font-weight: 700;
    transition: 0.0,1ms;
    cursor: pointer;
}

.btn-theme:hover {
    box-shadow: 3px 2px 10px var(--accent-primary);
    transform: scale(1.1);
}

/* Perfil Header */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: 0.3s;
    border: 1px solid transparent;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s;
}

.user-profile:hover .user-avatar {
    transform: scale(1.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- NOTIFICAÇÕES (SISTEMA COMPLETO) --- */
.notif-container {
    position: relative;
}

/* Badge com Contador Numérico */
.notif-badge {
    position: absolute;
    top: 0px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background-color: var(--danger);
    color: white;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-header);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

@keyframes pulseRed {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(234, 67, 53, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(234, 67, 53, 0);
    }
}

/* Dropdown */
.notif-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: -60px;
    width: min(300px, calc(100vw - 24px));
    max-height: 400px;
    background: var(--bg-form);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

.notif-dropdown.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-header {
    padding: 12px 15px;
    background: var(--bg-input);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.notif-list {
    max-height: 350px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: background 0.2s;
    position: relative;
}

.notif-item:hover {
    background: var(--bg-input);
}

/* 2. O design do botão (Invisível por padrão) */
.btn-excluir-notif {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-form);
    color: var(--danger);
    font-size: 11px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0; /* Começa escondido */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10;
}

/* 3. Faz o botão aparecer quando o mouse passa na notificação */
.notif-item:hover .btn-excluir-notif {
    opacity: 1;
}

/* 4. Efeito Shadow Destacado ao focar no próprio botão */
.btn-excluir-notif:hover {
    box-shadow: 0 6px 15px rgba(234, 67, 53, 0.35); /* Shadow com glow avermelhado */
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.notif-icon {
    min-width: 24px;
    text-align: center;
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

/* --- SIDEBAR "VIVA" (COM RODAPÉ) --- */
.sidebar {
    height: 100%;
    width: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, var(--bg-header) 0%, #1a252f 100%);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: hidden; /* ISSO AQUI ESCONDE OS BOTÕES QUANDO FECHADO */
}

.sidebar a {
    margin: 8px 15px;
    padding: 12px 20px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.75);
    transition: all 0.3s;
    border-left: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap; /* ISSO IMPEDE O TEXTO DE QUEBRAR PARA BAIXO */
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sidebar a:hover span.material-icons {
    transform: scale(1.2) rotate(5deg);
}

.sidebar a span.material-icons {
    transition: transform 0.3s ease, color 0.3s;
}

.admin-section {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent-primary) 18%, transparent), transparent 34%),
        linear-gradient(135deg, var(--bg-header), color-mix(in srgb, var(--bg-header) 78%, #000 22%));
    z-index: 9998;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    gap: 14px;
    opacity: 1;
    transition: opacity 0.38s ease, transform 0.38s ease;
    pointer-events: auto;
}

#loading-overlay.is-hidden {
    opacity: 0;
    transform: scale(1.015);
    pointer-events: none;
}

.site-loader-mark {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    animation: loaderFloat 1.8s ease-in-out infinite;
}

.site-loader-mark .material-icons {
    font-size: 38px;
}

.site-loader-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.site-loader-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
}

.site-loader-bar {
    width: min(240px, 68vw);
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
}

.site-loader-bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    animation: loaderBar 1.15s ease-in-out infinite;
}

@keyframes loaderFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes loaderBar {
    0% {
        transform: translateX(-105%);
    }
    100% {
        transform: translateX(245%);
    }
}

@media (prefers-reduced-motion: reduce) {
    #loading-overlay,
    .site-loader-mark,
    .site-loader-bar span {
        transition: none;
        animation: none;
    }
}

/* Sidebar Footer (Perfil) */
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: background 0.3s;
    min-width: 260px; /* ISSO MANTÉM O TAMANHO REAL DELE MESMO ESCONDIDO */
}
.sidebar-footer:hover {
    background: rgba(0, 0, 0, 0.3);
}

.footer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.footer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.footer-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.footer-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.footer-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- CONTEÚDO PRINCIPAL --- */
.main-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    perspective: 1000px;
    min-width: 0;
}

.screen {
    width: 100%;
    max-width: 800px;
    min-width: 0;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: pageEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

/* --- CARDS & BLINDAGEM DE INPUTS (FIX PARA TEXTO) --- */
.card {
    background: var(--bg-form);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    color: var(--text-main);
    transition: transform 0.3s, box-shadow 0.3s;
    min-width: 0;
}

.card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* AQUI ESTÁ A CORREÇÃO DE CORES DEFINITIVA */
input,
select,
textarea {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    transition: 0.3s;
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border: 2px solid var(--border-color) !important;
    -webkit-text-fill-color: var(--text-main) !important; /* Força cor no Chrome */
    opacity: 1 !important;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-primary) !important;
    /* Mantém o fundo do tema para não "sumir" com o texto claro */
    background-color: var(--bg-input) !important; 
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-input-shell {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-shell input {
    padding-right: 58px;
}

.barcode-help-btn {
    position: absolute;
    right: 7px;
    top: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    background: var(--accent-primary);
    color: var(--text-btn);
    z-index: 2;
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.24);
    transform: translateY(-50%);
}

.barcode-help-btn:hover {
    transform: translateY(-50%);
}

.barcode-help-btn:active {
    transform: translateY(-50%) scale(0.96);
}

.barcode-help-btn .material-icons {
    font-size: 20px;
}

/* Hack para Autofill (Remove fundo amarelo do navegador) */

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
}


input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* --- BOTÕES --- */
button {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    color: #fff;
}

button:active {
    transform: scale(0.96);
}

button:hover {
    filter: brightness(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--accent-primary);
}

.btn-success {
    background: var(--accent-secondary);
}

.btn-danger {
    background: var(--danger);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-muted) !important;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-main) !important;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    width: auto;
}

/* --- LISTAS E ANIMAÇÃO DE ITEM --- */
.animate-item {
    opacity: 0;
    animation: slideInItem 0.5s ease forwards;
}

@keyframes slideInItem {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.item-card {
    background: var(--bg-form);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    border-left: 5px solid var(--accent-primary);
    transition: transform 0.2s, box-shadow 0.2s;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.item-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.item-title {
    font-weight: 800;
    font-size: 17px;
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.item-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-main);
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: white;
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-main);
    transition: 0.2s;
}

.btn-icon:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.item-qtd {
    font-weight: 800;
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    color: var(--text-main);
}

.item-footer {
    margin-top: 10px;
    margin-left: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* --- DASHBOARD STATS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-input);
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-val {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 5px;
    font-weight: 600;
}

/* --- PERFIL --- */
.profile-pic-container {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.profile-pic-container:hover {
    transform: scale(1.05);
}

.profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-body);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.profile-pic-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom-left-radius: 60px;
    border-bottom-right-radius: 60px;
    backdrop-filter: blur(2px);
}

/* --- TABELAS ADMIN (FIX CORES) --- */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.user-table th {
    text-align: left;
    padding: 15px;
    background: var(--bg-input) !important;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted) !important;
    font-size: 12px;
    text-transform: uppercase;
}

.user-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    background: var(--bg-form) !important;
    color: var(--text-main) !important;
}

.user-row-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 10px;
    object-fit: cover;
    background: #eee;
}

/* --- MODAIS --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-form);
    padding: 30px;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
}
/* Ajuste de contraste para o cabeçalho do modal */
.modal-box h4 {
    color: var(--text-main);
}

.modal-overlay.open .modal-box {
    transform: scale(1);
    opacity: 1;
}

.barcode-help-modal {
    max-width: 440px;
    display: grid;
    gap: 14px;
    justify-items: center;
}

.barcode-help-modal h3 {
    margin: 0;
    color: var(--text-main);
}

.barcode-help-modal p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.barcode-help-example {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px dashed var(--accent-primary);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: monospace;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    word-break: break-word;
}

.system-toast-container {
    position: fixed;
    top: 84px;
    right: 18px;
    z-index: 220;
    display: grid;
    gap: 12px;
    pointer-events: none;
}

.system-toast {
    min-width: min(360px, calc(100vw - 32px));
    max-width: min(420px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-form) 92%, white 8%);
    color: var(--text-main);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.system-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.system-toast.is-success {
    border-color: rgba(16, 185, 129, 0.28);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), color-mix(in srgb, var(--bg-form) 94%, white 6%));
}

.system-toast.is-error {
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.16), color-mix(in srgb, var(--bg-form) 94%, white 6%));
}

.system-toast.is-warning {
    border-color: rgba(245, 158, 11, 0.28);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), color-mix(in srgb, var(--bg-form) 94%, white 6%));
}

.system-toast.is-info {
    border-color: rgba(59, 130, 246, 0.28);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), color-mix(in srgb, var(--bg-form) 94%, white 6%));
}

.system-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.7);
}

.system-toast.is-success .system-toast-icon {
    color: #059669;
}

.system-toast.is-error .system-toast-icon {
    color: #dc2626;
}

.system-toast.is-warning .system-toast-icon {
    color: #d97706;
}

.system-toast.is-info .system-toast-icon {
    color: #2563eb;
}

.system-toast-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.theme-btn {
    border-radius: 40%;
    padding: 5px;
    transition: 0.1s;
}

.theme-btn:hover {
    background-color: var(--accent-primary);
    box-shadow: 0px 1px 30px var(--accent-primary);
    transform: scale(1.1);
}

/* --- RESPONSIVIDADE PC --- */
@media (min-width: 768px) {
    .menu-icon {
        display: none;
    }

    .sidebar > span.material-icons[onclick="toggleSidebar()"] {
        display: none !important;
    }

    .sidebar {
        width: 260px;
    }

   .header {
    background: var(--bg-header);
    color: white;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

    .main-content {
        padding-left: 280px;
        padding-top: 40px;
    }

    .item-card {
        grid-template-columns: 2fr 1fr 1fr 0.5fr;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .system-toast-container {
        top: 68px;
        right: 12px;
        left: 12px;
    }

    .system-toast {
        min-width: 0;
        max-width: none;
    }
}

/* Destaque Visual nas Buscas (Aquele Amarelo Brilhante) */
.highlight-search {
    background-color: rgba(251, 188, 4, 0.3); 
    color: var(--warning);
    font-weight: 800;
    border-radius: 3px;
    padding: 0 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Cria uma linha alinhada à esquerda */
.checkbox-group {
    display: flex;
    align-items: center; /* Centraliza o quadrado com o texto verticalmente */
    justify-content: flex-start; /* Empurra os dois para a esquerda */
    gap: 8px; /* Dá um espacinho entre o quadrado e o texto */
    margin-bottom: 15px; /* Dá um respiro antes do botão de Cadastrar */
}

/* Tira o comportamento genérico de input (que geralmente tem width: 100%) */
.checkbox-group input[type="checkbox"] {
    width: auto; /* Deixa ele do tamanho natural dele */
    margin: 0;
    cursor: pointer;
}

/* Ajusta o texto para ficar certinho do lado */
.checkbox-group label {
    margin: 0;
    font-size: 16px;
    font-weight: 600;/* Deixa o texto um pouco mais destacado */
    color: var(--text-muted); /* Usa a cor do seu tema */
}

/* --- MELHORIAS PARA DISPOSITIVOS MÓVEIS --- */

@media (max-width: 768px) {
    body {
        overflow-x: hidden; /* Evitar overflow horizontal */
    }

    .header {
        height: 56px;
        gap: 8px;
        padding: 0 10px;
    }

    .app-title {
        color: white; /* Sempre branco no header escuro */
        font-size: 16px;
    }

    .menu-icon {
        margin-right: 2px;
    }

    .user-area {
        gap: 8px;
    }

    .theme-btn {
        align-items: center;
        display: inline-flex;
        justify-content: center;
        min-height: 40px;
        min-width: 40px;
        padding: 6px;
    }

    .user-profile {
        gap: 0;
        padding: 2px;
    }

    .header .user-profile span:not(.material-icons) {
        display: none !important;
    }

    .user-avatar {
        height: 32px;
        width: 32px;
    }

    .notif-dropdown {
        position: fixed;
        top: 62px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: min(72vh, 420px);
    }

    .notif-list {
        max-height: calc(min(72vh, 420px) - 48px);
    }

    .sidebar {
        height: 100%;
        width: 0;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 100;
        transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: linear-gradient(180deg, var(--bg-header) 0%, #1a252f 100%);
        display: flex;
        flex-direction: column;
        overflow-x: hidden;
    }
    
    .sidebar a {
        margin: 8px 15px;
        padding: 12px 20px;
        border-radius: 12px;
        color: rgba(255, 255, 255, 0.7);
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        white-space: nowrap;
        transition: 0.3s;
    }

    .sidebar a:hover,
    .sidebar a.active {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    

    .main-content {
        padding: 12px;
    }

    .card {
        padding: 18px;
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .row {
        gap: 14px;
        grid-template-columns: 1fr; /* Uma coluna para telas pequenas */
    }

    button {
        max-width: 100%;
        padding: 14px 16px;
        white-space: normal;
    }

    input,
    select,
    textarea {
        font-size: 14px; /* Tamanhos de fontes menores */
    }

    .item-card {
        grid-template-columns: 1fr; /* Uma coluna para cards em telas pequenas */
        padding: 16px;
    }

    .item-header,
    .item-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .item-footer {
        margin-left: 0;
    }

    .quick-actions {
        width: 100%;
        justify-content: space-between;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Ajustar para telas pequenas */
    }
}

/*Anim botao rodando*/

@media (max-width: 480px) {
    .header {
        padding: 0 8px;
    }

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

    .user-area {
        gap: 4px;
    }

    .theme-btn {
        min-height: 36px;
        min-width: 36px;
    }

    .main-content {
        padding: 8px;
    }

    .card {
        padding: 14px;
    }

    .item-title {
        font-size: 1rem; /* Tamanhos de fonte responsivos */
    }
}

/* Animação de Carregamento para Botões */
.animate-spin {
    animation: spin 1s linear infinite;
    display: inline-block; /* Necessário para o ícone não amassar */
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body.dialog-open {
    overflow: hidden;
}

.dashboard-ranking {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.06));
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 18px;
    padding: 22px;
}

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

.dashboard-ranking-head h3 {
    margin: 0;
    font-size: 18px;
}

.dashboard-ranking-head p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.dashboard-ranking-head .material-icons {
    font-size: 28px;
    color: var(--accent-primary);
}

.ranking-list {
    display: grid;
    gap: 12px;
}

.ranking-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: var(--bg-form);
    border: 1px solid var(--border-color);
}

.ranking-item-button {
    width: 100%;
    border: none;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.ranking-item-button:hover,
.ranking-item-button:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.28);
    box-shadow: 0 14px 26px rgba(59, 130, 246, 0.08);
    outline: none;
}

.ranking-position {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.ranking-body {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.ranking-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ranking-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-secondary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-zoom-trigger {
    padding: 0;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.avatar-zoom-trigger:focus-visible {
    outline: none;
}

.avatar-zoom-trigger:focus-visible .ranking-avatar,
.avatar-zoom-trigger:focus-visible .activity-user-avatar {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.ranking-avatar-trigger,
.activity-user-avatar-trigger {
    flex-shrink: 0;
}

.ranking-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ranking-name {
    font-weight: 700;
    color: var(--text-main);
}

.ranking-last-update {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

.ranking-stats {
    text-align: right;
    flex-shrink: 0;
}

.ranking-stat-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}

.ranking-stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.activity-hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.activity-user-profile {
    display: grid;
}

.activity-user-card {
    display: grid;
    gap: 22px;
    padding: 24px;
    border-radius: 22px;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(53, 102, 209, 0.08), rgba(16, 185, 129, 0.06));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.activity-user-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.activity-user-avatar {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
}

.activity-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.activity-user-copy h3 {
    margin: 6px 0 0;
    font-size: 28px;
}

.activity-user-copy p {
    margin: 6px 0 0;
    color: var(--text-muted);
}

.activity-user-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(53, 102, 209, 0.12);
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.activity-user-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.activity-user-stats article {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(53, 102, 209, 0.08);
}

.activity-user-stats span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.activity-user-stats strong {
    display: block;
    margin-top: 10px;
    color: var(--text-main);
    font-size: 22px;
    line-height: 1.4;
}

.activity-timeline-list {
    display: grid;
    gap: 14px;
}

.activity-log-card {
    display: grid;
    grid-template-columns: auto 1.4fr 1fr;
    gap: 16px;
    align-items: flex-start;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-form) 94%, white 6%);
}

.activity-log-main strong,
.audit-action-cell strong,
.audit-primary-cell strong {
    display: block;
    color: var(--text-main);
    font-weight: 700;
}

.activity-log-main p,
.activity-log-side span,
.audit-primary-cell div span {
    margin: 6px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.activity-log-side {
    display: grid;
    gap: 8px;
    justify-items: end;
    text-align: right;
}

.activity-log-side small {
    color: var(--text-main);
    font-weight: 600;
}

.activity-empty-state {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: flex-start;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed var(--border-color);
    background: var(--bg-input);
}

.activity-empty-state .material-icons {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(53, 102, 209, 0.12);
    color: var(--accent-primary);
}

.activity-empty-state strong {
    display: block;
    color: var(--text-main);
}

.activity-empty-state p {
    margin: 6px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.audit-table td {
    vertical-align: top;
}

.audit-primary-cell,
.audit-action-cell {
    display: grid;
    gap: 8px;
}

.audit-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    width: fit-content;
}

.audit-chip.is-add {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.audit-chip.is-edit,
.audit-chip.is-adjust {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.audit-chip.is-delete {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.audit-chip.is-security {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.audit-chip.is-neutral {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
}

.pagination-shell {
    margin-top: 18px;
}

.pagination-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-btn {
    min-width: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-form);
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.pagination-btn:hover:not(:disabled),
.pagination-btn:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(53, 102, 209, 0.28);
    background: rgba(53, 102, 209, 0.06);
    outline: none;
}

.pagination-btn.is-active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: var(--text-muted);
    font-weight: 700;
}

.activity-user-card.is-loading,
.activity-log-card.is-loading {
    background: linear-gradient(135deg, rgba(53, 102, 209, 0.05), rgba(53, 102, 209, 0.02));
}

.activity-user-skeleton,
.activity-log-skeleton {
    display: block;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 8%, rgba(53, 102, 209, 0.2) 28%, rgba(148, 163, 184, 0.12) 48%);
    background-size: 220% 100%;
    animation: ranking-shimmer 1.3s linear infinite;
}

.activity-user-skeleton.is-avatar {
    width: 72px;
    height: 72px;
}

.activity-user-skeleton.is-title {
    width: 42%;
    height: 22px;
}

.activity-user-skeleton.is-text {
    width: 66%;
    height: 14px;
}

.activity-log-skeleton.is-chip {
    width: 78px;
    height: 30px;
}

.activity-log-skeleton.is-main {
    width: 100%;
    height: 52px;
}

.activity-log-skeleton.is-side {
    width: 100%;
    height: 52px;
}

.ranking-empty {
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-form);
    border: 1px dashed var(--border-color);
}

.ranking-loading-card {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(53, 102, 209, 0.08), rgba(53, 102, 209, 0.03));
    border: 1px solid rgba(53, 102, 209, 0.12);
}

.tower-loader {
    width: 84px;
    height: 72px;
    border-radius: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    background: linear-gradient(180deg, rgba(53, 102, 209, 0.1), rgba(53, 102, 209, 0.04));
    box-shadow: inset 0 0 0 1px rgba(53, 102, 209, 0.09);
}

.tower-loader span {
    width: 8px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #4f8fff, #3566d1);
    transform-origin: bottom center;
    animation: tower-pulse 1s ease-in-out infinite;
}

.tower-loader span:nth-child(1) {
    height: 18px;
    animation-delay: 0s;
}

.tower-loader span:nth-child(2) {
    height: 31px;
    animation-delay: 0.12s;
}

.tower-loader span:nth-child(3) {
    height: 23px;
    animation-delay: 0.24s;
}

.ranking-loading-copy {
    display: grid;
    gap: 10px;
}

.ranking-loading-line {
    display: block;
    height: 12px;
    width: 68%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.12) 8%, rgba(53, 102, 209, 0.2) 28%, rgba(148, 163, 184, 0.12) 48%);
    background-size: 220% 100%;
    animation: ranking-shimmer 1.3s linear infinite;
}

.ranking-loading-line.is-wide {
    width: 92%;
}

@keyframes tower-pulse {
    0%, 100% {
        transform: scaleY(0.72);
        opacity: 0.72;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

@keyframes ranking-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.legacy-admin-hide {
    display: none;
}

@media (max-width: 768px) {
    .activity-hero-actions,
    .activity-user-head {
        flex-direction: column;
        align-items: stretch;
    }

    .activity-user-stats {
        grid-template-columns: 1fr;
    }

    .activity-log-card {
        grid-template-columns: 1fr;
    }

    .activity-log-side {
        justify-items: start;
        text-align: left;
    }

    .pagination-nav {
        gap: 8px;
    }
}

.management-shell {
    display: grid;
    gap: 22px;
}

.management-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.management-hero h2 {
    margin: 8px 0 0;
}

.management-hero p {
    margin: 8px 0 0;
    max-width: 620px;
    color: var(--text-muted);
    line-height: 1.55;
}

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

.management-stat-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-form) 90%, white 10%), var(--bg-form));
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.management-stat-card span,
.management-stat-card small {
    display: block;
    color: var(--text-muted);
}

.management-stat-card span {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.management-stat-card strong {
    display: block;
    margin: 10px 0 6px;
    font-size: 34px;
    line-height: 1;
    color: var(--text-main);
}


.announcement-grid {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-form) 94%, white 6%);
    box-shadow: -12px 13px 9px 7px rgba(15, 23, 42, 0.06);
    margin-top: 15px;
}

.management-panel {
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-form) 94%, white 6%);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
}

.management-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.management-panel-head h3 {
    margin: 0;
}

.management-panel-head p {
    margin: 6px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.management-panel-count {
    min-width: 42px;
    padding: 7px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(53, 102, 209, 0.1);
    color: var(--accent-primary);
    font-weight: 800;
}

.management-inline-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.24);
    color: var(--text-main);
}

.management-inline-banner .material-icons {
    color: #d97706;
}

.management-modal-box {
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    text-align: left;
    padding: 28px;
}

.management-modal-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.management-modal-top h3 {
    margin: 8px 0 0;
    font-size: 28px;
}

.management-modal-top p {
    margin: 8px 0 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.management-modal-form {
    display: grid;
    gap: 18px;
}

.announcement-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.announcement-label-row span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.announcement-validation-box {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    background: rgba(245, 158, 11, 0.09);
    color: var(--text-main);
    line-height: 1.5;
}

.announcement-validation-box.is-valid {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.1);
}

.announcement-validation-box.is-error {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.1);
}

.announcement-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    cursor: pointer;
    color: var(--text-main);
    line-height: 1.5;
}

.announcement-check input {
    margin-top: 3px;
    accent-color: var(--accent-primary);
}

.announcement-preview-card {
    display: grid;
    gap: 8px;
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(53, 102, 209, 0.12), rgba(16, 185, 129, 0.08));
    border: 1px solid rgba(53, 102, 209, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.announcement-preview-card--modal {
    margin-top: 4px;
}

.announcement-preview-kicker {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-primary);
}

.announcement-preview-card strong {
    font-size: 24px;
    color: var(--text-main);
}

.announcement-preview-card p,
.announcement-preview-card small {
    margin: 0;
    color: var(--text-main);
    line-height: 1.55;
}

.announcement-preview-card small {
    color: var(--text-muted);
}

.announcement-rules {
    display: grid;
    gap: 14px;
}

.announcement-rule {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.announcement-rule .material-icons {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(53, 102, 209, 0.1);
    color: var(--accent-primary);
}

.announcement-rule strong,
.user-row-name {
    display: block;
    color: var(--text-main);
    font-weight: 700;
}

.announcement-rule p,
.user-row-meta {
    margin: 4px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

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

.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.management-confirm-box {
    width: min(470px, calc(100% - 32px));
    text-align: center;
    display: grid;
    gap: 14px;
}

.management-confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: rgba(53, 102, 209, 0.12);
    color: var(--accent-primary);
}

.management-confirm-icon.is-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.management-confirm-icon.is-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.management-confirm-box h3 {
    margin: 0;
    font-size: 26px;
}

.management-confirm-box p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.management-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
}

.profile-dialog-overlay {
    z-index: 120;
}

.profile-dialog-box {
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    text-align: left;
    padding: 28px;
}

.profile-dialog-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.profile-dialog-top h3 {
    margin: 6px 0 8px;
    font-size: 28px;
}

.profile-dialog-top p {
    margin: 0;
    color: var(--text-muted);
}

.profile-dialog-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-primary);
}

.profile-dialog-close {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
}

.profile-dialog-close:hover {
    color: var(--text-main);
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.profile-dialog-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.profile-dialog-summary h4 {
    margin: 0 0 8px;
    font-size: 22px;
}

.profile-dialog-form {
    display: grid;
    gap: 18px;
}

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

.profile-security-note {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(251, 188, 4, 0.12);
    border: 1px solid rgba(251, 188, 4, 0.3);
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.5;
}

.profile-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.profile-crop-box {
    width: min(860px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 28px;
    text-align: left;
}

.profile-crop-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 24px;
    align-items: start;
}

.profile-crop-stage {
    display: grid;
    place-items: center;
    padding: 12px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.profile-crop-viewport {
    position: relative;
    width: min(100%, 420px);
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 28px;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%);
    background-size: 28px 28px;
    background-position: 0 0, 0 14px, 14px -14px, -14px 0;
    touch-action: none;
    cursor: grab;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.profile-crop-viewport.is-dragging {
    cursor: grabbing;
}

.profile-crop-viewport::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 28px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.92), inset 0 0 0 6px rgba(15, 23, 42, 0.08);
    pointer-events: none;
}

.profile-crop-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    touch-action: none;
}

.profile-crop-sidebar {
    display: grid;
    gap: 14px;
    align-content: start;
}

.profile-crop-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-crop-label-row label {
    font-weight: 700;
    color: var(--text-main);
}

.profile-crop-label-row strong {
    color: var(--accent-primary);
}

.profile-crop-range {
    width: 100%;
}

.photo-viewer-overlay {
    z-index: 140;
    backdrop-filter: blur(14px);
}

.photo-viewer-box {
    width: min(780px, calc(100% - 24px));
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    display: grid;
    gap: 18px;
    text-align: left;
}

.photo-viewer-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.photo-viewer-top h3 {
    margin: 6px 0 8px;
    font-size: 26px;
}

.photo-viewer-top p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.photo-viewer-stage {
    position: relative;
    min-height: min(68vh, 560px);
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.22), transparent 52%),
        linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.18);
    display: grid;
    place-items: center;
}

.photo-viewer-image {
    width: 100%;
    height: 100%;
    max-height: min(68vh, 560px);
    object-fit: contain;
    display: block;
    padding: 20px;
}

.photo-viewer-actions {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.photo-viewer-actions.is-hidden {
    display: none;
}

.photo-viewer-action-btn {
    border: none;
    border-radius: 999px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #fff;
    background: rgba(15, 23, 42, 0.76);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: transform 0.18s ease, background 0.18s ease;
}

.photo-viewer-action-btn:hover {
    transform: translateY(-1px);
    background: rgba(30, 41, 59, 0.92);
}

.photo-viewer-action-btn.is-danger {
    background: rgba(220, 38, 38, 0.86);
}

.photo-viewer-action-btn.is-danger:hover {
    background: rgba(185, 28, 28, 0.96);
}

.photo-viewer-note {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.14);
    color: var(--text-muted);
}

.photo-viewer-note .material-icons {
    color: var(--accent-primary);
}

.photo-viewer-note p {
    margin: 0;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .photo-viewer-box {
        width: calc(100% - 18px);
        padding: 20px;
    }

    .photo-viewer-stage {
        min-height: min(60vh, 420px);
    }

    .photo-viewer-image {
        max-height: min(60vh, 420px);
        padding: 14px;
    }

    .photo-viewer-actions {
        left: 14px;
        right: 14px;
        bottom: 14px;
        justify-content: stretch;
    }

    .photo-viewer-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .ranking-loading-card {
        grid-template-columns: 1fr;
    }

    .tower-loader {
        width: 100%;
        max-width: 120px;
    }

    .ranking-body {
        align-items: flex-start;
        flex-direction: column;
    }

    .ranking-stats {
        text-align: left;
    }

    .profile-dialog-box {
        width: calc(100% - 20px);
        padding: 20px;
    }

    .profile-dialog-top h3 {
        font-size: 24px;
    }

    .profile-dialog-hero {
        flex-direction: column;
        text-align: center;
    }

    .profile-dialog-grid {
        grid-template-columns: 1fr;
    }

    .management-hero,
    .management-panel-head,
    .management-inline-banner,
    .management-confirm-actions {
        grid-template-columns: 1fr;
        display: grid;
    }

    .management-stat-grid,
    .management-users-grid,
    .announcement-grid {
        grid-template-columns: 1fr;
    }

    .management-inline-banner {
        gap: 10px;
    }

    .management-panel-count {
        justify-self: flex-start;
    }

    .user-actions {
        justify-content: flex-start;
    }

    .management-modal-box {
        width: calc(100% - 20px);
        padding: 20px;
    }

    .management-modal-top h3,
    .management-confirm-box h3 {
        font-size: 24px;
    }

    .profile-crop-box {
        width: calc(100% - 20px);
        padding: 20px;
    }

    .profile-crop-layout {
        grid-template-columns: 1fr;
    }

    .profile-dialog-actions {
        flex-direction: column-reverse;
    }

    .profile-dialog-actions button {
        width: 100%;
    }

    .management-confirm-actions button {
        width: 100%;
    }
}


.profile-dialog-box {
    width: min(760px, calc(100% - 24px));
    max-height: calc(100vh - 40px);
    padding: 22px;
    border-radius: 20px;
    background: var(--bg-form);
    border: 1px solid var(--border-color);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.28) transparent;
    scrollbar-gutter: stable;
}

.profile-dialog-box::-webkit-scrollbar {
    width: 10px;
}

.profile-dialog-box::-webkit-scrollbar-track {
    background: transparent;
    margin: 10px 6px 10px 0;
}

.profile-dialog-box::-webkit-scrollbar-thumb {
    border-radius: 999px;
    border: 3px solid transparent;
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.34), rgba(148, 163, 184, 0.42))
        content-box;
}

.profile-dialog-box::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.48), rgba(100, 116, 139, 0.52))
        content-box;
}

.profile-dialog-box::-webkit-scrollbar-corner {
    background: transparent;
}

.profile-dialog-top {
    margin-bottom: 18px;
}

.profile-dialog-top h3 {
    margin: 6px 0 8px;
    font-size: 24px;
}

.profile-dialog-top p {
    max-width: 560px;
    font-size: 14px;
    line-height: 1.5;
}

.profile-dialog-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.profile-dialog-summary {
    display: grid;
    gap: 8px;
}

.profile-dialog-summary h4 {
    margin: 0;
    font-size: 20px;
}

.profile-dialog-summary p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.profile-dialog-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.profile-dialog-stat {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--bg-form);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.profile-dialog-stat span {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-dialog-stat strong {
    display: block;
    margin-top: 6px;
    font-size: 16px;
    color: var(--text-main);
}

.profile-dialog-stat small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.35;
}

.profile-dialog-form {
    gap: 14px;
}

.profile-dialog-section {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.profile-dialog-section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.profile-dialog-section-head h4 {
    margin: 0 0 4px;
    font-size: 16px;
}

.profile-dialog-section-head p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
}

.profile-section-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--accent-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profile-section-chip.is-protected {
    background: rgba(251, 188, 4, 0.12);
    color: #b7791f;
}

.profile-password-lock {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(59, 130, 246, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.profile-password-lock:hover {
    border-color: rgba(59, 130, 246, 0.24);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.08);
}

.profile-password-lock.is-unlocked {
    cursor: text;
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.profile-password-lock-copy label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-password-lock-copy p {
    margin: 0;
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.45;
}

.profile-password-lock-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.profile-password-lock-field input {
    border-radius: 12px;
}

.profile-password-lock.is-locked .profile-password-lock-field input {
    filter: blur(7px);
    letter-spacing: 0.28em;
    pointer-events: none;
    user-select: none;
}

.profile-password-lock.is-loading .profile-password-lock-field input {
    opacity: 0.72;
}

.profile-password-lock.is-unlocked .profile-password-lock-field input {
    filter: none;
    letter-spacing: normal;
    pointer-events: auto;
    user-select: text;
}

.profile-password-lock-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    background: rgba(59, 130, 246, 0.08);
    color: var(--accent-primary);
}

.profile-password-lock.is-unlocked .profile-password-lock-btn {
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-secondary);
}

.profile-security-note-inline {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: flex-start;
}

.profile-security-note-inline .material-icons {
    font-size: 20px;
    color: #b7791f;
}

.profile-session-refresh {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.profile-session-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-session-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(59, 130, 246, 0.12);
    font-size: 12px;
    font-weight: 600;
}

.profile-session-badge .material-icons {
    font-size: 18px;
    color: var(--accent-primary);
}

.profile-session-list {
    display: grid;
    gap: 10px;
}

.profile-session-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.profile-session-card.is-current {
    border-color: rgba(16, 185, 129, 0.24);
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.08);
}

.profile-session-card-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(16, 185, 129, 0.12));
    color: var(--accent-primary);
}

.profile-session-card-icon .material-icons {
    font-size: 22px;
}

.profile-session-card-body {
    min-width: 0;
}

.profile-session-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.profile-session-card-head strong {
    display: block;
    font-size: 15px;
    line-height: 1.3;
}

.profile-session-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.profile-session-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.profile-session-tag.is-current {
    background: rgba(16, 185, 129, 0.14);
    color: #0f8a61;
}

.profile-session-action {
    width: auto;
    min-width: 132px;
    align-self: flex-start;
    font-size: 12px;
    padding: 10px 12px;
}

.profile-session-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.profile-session-card-grid div {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.profile-session-card-grid span {
    display: block;
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-session-card-grid strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.profile-session-card-agent {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    word-break: break-word;
}

.profile-session-empty {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px dashed rgba(148, 163, 184, 0.32);
    background: rgba(59, 130, 246, 0.04);
}

.profile-session-empty .material-icons {
    font-size: 28px;
    color: var(--accent-primary);
}

.profile-session-empty strong,
.profile-session-empty p {
    margin: 0;
}

.profile-session-empty p {
    margin-top: 6px;
    color: var(--text-muted);
    line-height: 1.55;
}

.profile-session-card.is-loading {
    align-items: center;
}

.profile-session-skeleton {
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.2), rgba(59, 130, 246, 0.12), rgba(148, 163, 184, 0.2));
    background-size: 240px 100%;
    animation: profileSessionPulse 1.35s linear infinite;
}

.profile-session-skeleton.is-title {
    height: 18px;
    width: 58%;
    margin-bottom: 12px;
}

.profile-session-skeleton.is-text {
    height: 12px;
    margin-top: 10px;
}

.profile-password-modal-box {
    width: min(420px, calc(100% - 24px));
    padding: 22px;
    text-align: left;
}

.profile-password-modal-form {
    display: grid;
    gap: 18px;
}

@keyframes profileSessionPulse {
    0% {
        background-position: 240px 0;
    }
    100% {
        background-position: -240px 0;
    }
}

@media (max-width: 900px) {
    .profile-dialog-box {
        width: min(700px, calc(100% - 24px));
    }
}

@media (max-width: 768px) {
    .profile-dialog-box,
    .profile-crop-box,
    .profile-password-modal-box {
        width: calc(100% - 18px);
        padding: 20px;
    }

    .profile-dialog-top h3 {
        font-size: 24px;
    }

    .profile-dialog-hero {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .profile-dialog-stats,
    .profile-dialog-grid,
    .profile-session-card-grid,
    .profile-crop-layout {
        grid-template-columns: 1fr;
    }

    .profile-dialog-section,
    .profile-dialog-hero {
        padding: 18px;
    }

    .profile-dialog-section-head,
    .profile-session-card-head,
    .profile-password-lock-field,
    .profile-security-note-inline {
        grid-template-columns: 1fr;
        display: grid;
    }

    .profile-dialog-section-head {
        gap: 12px;
    }

    .profile-session-action,
    .profile-session-refresh {
        width: 100%;
    }

    .profile-dialog-actions {
        flex-direction: column-reverse;
    }

    .profile-dialog-actions button {
        width: 100%;
    }

    .profile-session-card {
        grid-template-columns: 1fr;
    }
}

#modalGestaoConfirmacao {
    z-index: 160;
}

.print-box-tools {
    margin-top: 18px;
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed var(--border-color);
    background: rgba(59, 130, 246, 0.04);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
}

.item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.product-detail-box,
.thermal-modal-box {
    width: min(720px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    text-align: left;
}

.product-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.product-detail-top h3 {
    margin: 8px 0 0;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.product-detail-field {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.product-detail-field span {
    display: block;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.product-detail-field strong {
    color: var(--text-main);
    font-size: 15px;
}

.product-detail-actions,
.thermal-size-grid {
    display: flex;
    gap: 12px;
}

.thermal-size-grid {
    flex-wrap: wrap;
}

.thermal-size-card {
    flex: 1 1 220px;
    min-height: 150px;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    text-align: left;
    display: grid;
    gap: 10px;
    align-content: start;
}

.thermal-size-card strong {
    font-size: 20px;
}

.thermal-size-card span,
.thermal-size-card small {
    color: var(--text-muted);
}

#printEtiquetaStage {
    display: none;
    background: #fff;
}

#printEtiqueta {
    --print-label-width: 101.6mm;
    --print-label-height: 152.4mm;
    display: block;
    width: var(--print-label-width);
    height: var(--print-label-height);
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#printEtiquetaInner {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.thermal-label {
    width: var(--print-label-width);
    height: var(--print-label-height);
    background: #fff;
    color: #000;
    box-sizing: border-box;
    overflow: hidden;
    font-family: Arial, sans-serif;
    break-inside: avoid;
    page-break-inside: avoid;
    page-break-after: avoid;
}

.thermal-label.is-small {
    --print-label-width: 40mm;
    --print-label-height: 60mm;
}

.thermal-label.is-large {
    --print-label-width: 101.6mm;
    --print-label-height: 152.4mm;
}

.thermal-label-content {
    margin-top: 1em;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: #fff;
    color: #000;
}

.thermal-label.is-small .thermal-label-content {
    margin-top: 0;
}

.thermal-label-large {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 6mm;
    padding: 8mm 8mm 7mm;
}

.thermal-label-header {
    display: grid;
    gap: 2.5mm;
    align-content: start;
}

.thermal-label-kicker {
    font-size: 3.2mm;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.thermal-label-brand {
    font-size: 5mm;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.thermal-label-title {
    font-size: 13mm;
    line-height: 0.95;
    font-weight: 900;
    word-break: break-word;
}

.thermal-label-subtitle {
    margin-top: 3em;
    font-size: 4.4mm;
    line-height: 1.2;
    min-height: 5mm;
}

.thermal-label-large-body {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) 38mm;
    gap: 6mm;
    align-items: stretch;
}

.thermal-label-large-body--box {
    grid-template-columns: minmax(0, 1fr) 40mm;
}

.thermal-label-meta {
    margin: 2em 0px 1em 0em;
    display: grid;
    gap: 2.4mm;
    align-content: start;
}

.thermal-label-meta-row {
    border: 0.35mm solid #000;
    border-radius: 1.4mm;
    padding: 2.4mm 2.8mm;
    display: grid;
    gap: 0.8mm;
}

.thermal-label-meta strong {
    display: block;
    font-size: 3mm;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.thermal-label-meta span {
    display: block;
    font-size: 4.2mm;
    line-height: 1.15;
    word-break: break-word;
}

.thermal-label-qr-wrap,
.thermal-label-qr-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 0.45mm solid #000;
    border-radius: 1.8mm;
    padding: 2.5mm;
    gap: 2mm;
    
    /* O SEGREDO DO GRID: Permite que a coluna esmague esse painel para os 38mm exatos */
    min-width: 0; 
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.thermal-label-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden; /* CORTA VAZAMENTOS */
}

/* Força a imagem de 960px a caber na caixinha pequena */
.thermal-label-qr canvas,
.thermal-label-qr img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.thermal-label-caption {
    margin: 0;
    font-size: 3.2mm;
    line-height: 1.1;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    word-break: break-word;
}

.thermal-label-small {
    margin-top: 0;
    display: grid;
    grid-template-rows: 28mm auto;
    justify-items: center;
    align-content: start;
    gap: 1mm;
    padding: 2mm;
}

.thermal-label-small .thermal-label-qr {
    width: 28mm;
    height: 28mm;
}

.thermal-label-small .thermal-label-caption {
    margin: 0;
    font-size: 3mm;
    line-height: 1.1;
    letter-spacing: 0.04em;
    max-width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thermal-label-small--product {
    display: flex;
    flex-direction: column;
    justify-items: stretch;
    align-content: stretch;
    gap: 1.2mm;
    padding: 2mm 2.4mm;
    overflow: hidden;
}

.thermal-label-small-info {
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    align-content: start;
    gap: 0.65mm;
    font-size: 3.35mm;
    line-height: 1.08;
    color: #000;
    overflow: hidden;
}

.thermal-label-small-info div {
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thermal-label-small-info strong {
    font-weight: 900;
}

.thermal-label-small-info span {
    font-weight: 700;
}

.thermal-label-barcode {
    display: block;
    flex: 0 0 16mm;
    width: 100% !important;
    height: 16mm !important;
    max-height: 16mm !important;
    overflow: hidden;
}

@media (max-width: 768px) {
    .print-box-tools,
    .product-detail-grid,
    .product-detail-actions {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .print-box-tools button,
    .product-detail-actions button {
        width: 100%;
    }

    .item-actions {
        justify-content: flex-start;
    }
}

@media print {
    @page {
        margin: 0;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        width: auto;
        height: auto;
        overflow: hidden !important;
    }

    body > *:not(#printEtiquetaStage):not(#dynamicPrintStyle) {
        display: none !important;
    }

    body * {
        visibility: hidden !important;
    }

    #printEtiquetaStage,
    #printEtiquetaStage * {
        visibility: visible !important;
    }

    #printEtiquetaStage {
        display: block !important;
        position: fixed !important;
        inset: 0 auto auto 0 !important;
        background: #fff !important;
        z-index: 99999 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    #printEtiqueta {
        margin: 0 !important;
        display: block !important;
        box-shadow: none !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
        overflow: hidden !important;
    }

    .thermal-label-qr canvas,
    .thermal-label-qr img {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* Esconde o canvas e mostra só a Imagem para não empurrar o layout */
    .thermal-label-qr canvas {
        display: none !important;
    }
    
    .thermal-label-qr img {
        display: block !important;
    }

    .thermal-label-barcode,
    .thermal-label-barcode * {
        visibility: visible !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
