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

:root {
    --primary: #58cc02;
    --primary-light: #7ae542;
    --primary-dark: #3d8f00;
    --secondary: #2d3748;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --dark: #1a202c;
    --light: #f7fafc;
    --gray: #718096;
    --border: #e2e8f0;
    --bg: #f5f7fa;
    --sidebar-width: 260px;
    --sidebar-transition: 0.3s ease;
}

body {
    font-family: 'Nunito Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
}

.bg-pattern {
    background-color: #2d3748;
    background-image:
        linear-gradient(30deg, #58cc02 12%, transparent 12.5%, transparent 87%, #58cc02 87.5%, #58cc02),
        linear-gradient(150deg, #58cc02 12%, transparent 12.5%, transparent 87%, #58cc02 87.5%, #58cc02),
        linear-gradient(30deg, #58cc02 12%, transparent 12.5%, transparent 87%, #58cc02 87.5%, #58cc02),
        linear-gradient(150deg, #58cc02 12%, transparent 12.5%, transparent 87%, #58cc02 87.5%, #58cc02),
        linear-gradient(60deg, #3d8f0077 25%, transparent 25.5%, transparent 75%, #3d8f0077 75%, #3d8f0077),
        linear-gradient(60deg, #3d8f0077 25%, transparent 25.5%, transparent 75%, #3d8f0077 75%, #3d8f0077);
    background-size: 40px 70px;
    background-position: 0 0, 0 0, 20px 35px, 20px 35px, 0 0, 20px 35px;
    opacity: 0.05;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: transform var(--sidebar-transition);
}

html.sidebar-collapsed .sidebar,
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-state-init .sidebar,
body.sidebar-state-init .main-content {
    transition: none !important;
}

.sidebar-header {
    padding: 25px 20px;
    background: rgba(88, 204, 2, 0.1);
    border-bottom: 2px solid var(--primary);
    position: relative;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header .logo-mark {
    width: 32px;
    height: 32px;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-header .logo-preview-display,
.sidebar-logo-wrap.logo-preview-display {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-header .logo-preview-display img,
.sidebar-logo-wrap.logo-preview-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
    mix-blend-mode: normal;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
}

.nav-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem 0.4rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s, background 0.2s;
}

.nav-group-toggle:hover {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.04);
}

.nav-group.is-open > .nav-group-toggle {
    color: rgba(255, 255, 255, 0.85);
}

.nav-group-chevron {
    flex-shrink: 0;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.2s;
    opacity: 0.8;
}

.nav-group.is-open > .nav-group-toggle .nav-group-chevron {
    transform: rotate(45deg);
}

.nav-submenu {
    display: none;
    padding-bottom: 0.35rem;
}

.nav-group.is-open > .nav-submenu {
    display: block;
}

.nav-submenu .nav-item {
    padding-left: 1.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 12px 20px;
    color: #cbd5e0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.nav-item:hover {
    background: rgba(88, 204, 2, 0.1);
    color: white;
    padding-left: 25px;
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(88, 204, 2, 0.2), transparent);
    color: white;
    border-left-color: var(--primary);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item .icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    transition: margin-left var(--sidebar-transition);
}

html.sidebar-collapsed .main-content,
body.sidebar-collapsed .main-content {
    margin-left: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--light);
    color: var(--secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
    position: relative;
    z-index: 120;
}

.btn-sidebar-toggle:hover {
    background: rgba(88, 204, 2, 0.12);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-sidebar-toggle .toggle-icon-closed {
    display: none;
}

body.sidebar-collapsed .btn-sidebar-toggle .toggle-icon-open {
    display: none;
}

body.sidebar-collapsed .btn-sidebar-toggle .toggle-icon-closed {
    display: inline;
}

.topbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(88, 204, 2, 0.1);
    position: sticky;
    top: 0;
    z-index: 110;
    border-bottom: 2px solid rgba(88, 204, 2, 0.1);
}

.topbar-left h1,
.topbar h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--secondary);
    position: relative;
}

.topbar-left h1::after,
.topbar h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    font-size: 0.875rem;
    color: #555;
}

.user-info small {
    color: #888;
    margin-left: 0.25rem;
}

.content {
    padding: 1.5rem;
    flex: 1;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, white 0%, #f7fafc 100%);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(88, 204, 2, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(88, 204, 2, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.info    { border-left-color: var(--info); }

.stat-label {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 0.35rem;
}

/* Cards dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid rgba(88, 204, 2, 0.1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), var(--primary));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.05), transparent);
}

.card-header > div {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--secondary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 1rem 1.25rem;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.required {
    color: var(--danger);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.4rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.card-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.card-body table th,
.card-body table td {
    padding: 0.6rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.card-body table th {
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    background: #fafafa;
    border-bottom: 1px solid var(--border);
    text-transform: none;
    letter-spacing: normal;
}

.card-body table thead {
    background: #fafafa;
}

.card-body table tbody tr:hover {
    background: #f9f9f9;
}

.card h3 {
    font-size: 0.875rem;
    color: #666;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.card-label {
    font-size: 0.75rem;
    color: #999;
}

.card-warning .card-value { color: #f57c00; }
.card-danger .card-value { color: #e53935; }
.card-success .card-value { color: #2e7d32; }

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.text-muted {
    color: #888;
    font-size: 0.9rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    font-weight: 600;
    color: #555;
    background: #fafafa;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-aberta { background: #e3f2fd; color: #1565c0; }
.badge-em_producao { background: #fff3e0; color: #ef6c00; }
.badge-finalizada { background: #e8f5e9; color: #2e7d32; }
.badge-cancelada { background: #fce4ec; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-warning { background: #fff3e0; color: #ef6c00; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #fdecea; color: #c62828; }
.badge-secondary { background: #eceff1; color: #546e7a; }
.badge-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

/* Table container */
.table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    border: 1px solid rgba(88, 204, 2, 0.1);
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.05), transparent);
    border-bottom: 2px solid rgba(88, 204, 2, 0.1);
}

.search-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.search-box input[type="text"] {
    padding: 0.55rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 220px;
    flex: 1;
}

.search-box input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.12);
}

.table-toolbar > div {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-container table th,
.table-container table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table-container table thead,
table thead {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

.table-container table th,
table th {
    font-weight: 600;
    color: white;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--primary);
}

.table-container table tbody tr:hover,
table tbody tr:hover {
    background: rgba(88, 204, 2, 0.05);
}

.panel {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.panel h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #16213e;
}

.panel p {
    color: #666;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #e53935;
    color: #fff;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(88, 204, 2, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 6px 12px rgba(88, 204, 2, 0.3);
    transform: translateY(-1px);
    opacity: 1;
}

.btn-success {
    background: #2e7d32;
    color: #fff;
}

.btn-warning {
    background: #f57c00;
    color: #fff;
}

.btn-info {
    background: #0288d1;
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: #555;
    border: 1px solid #ccc;
}

.btn-outline:hover {
    background: #f5f5f5;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.alert-error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
    margin-bottom: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray);
    font-size: 0.9rem;
}

.logo-mark-lg {
    width: 48px;
    height: 48px;
    font-size: 28px;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 8px;
    background: #fff;
}

.logo-preview.logo-preview-lg.logo-preview-display {
    border: none;
    background: transparent;
    padding: 0;
}

.logo-preview.logo-preview-lg:not(.logo-preview-display) {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 8px;
    background: #fff;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: transparent;
}

.logo-preview .logo-mark {
    width: 48px;
    height: 48px;
    font-size: 24px;
}

.logo-preview-lg {
    width: 120px;
    height: 120px;
}

.logo-preview-display {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    flex-shrink: 0;
}

.logo-preview-display img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: none;
}

.home-empresa-logo {
    flex-shrink: 0;
}

.logo-mark-xl {
    width: 72px;
    height: 72px;
    font-size: 36px;
}

.home-empresa-banner {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, white 0%, #f7fafc 100%);
    border: 1px solid rgba(88, 204, 2, 0.15);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.home-empresa-info h2 {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 6px;
}

.home-empresa-info p {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 2px 0;
}

/* Login page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    position: relative;
    overflow: hidden;
    padding: 1rem;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 35px,
        rgba(88, 204, 2, 0.05) 35px,
        rgba(88, 204, 2, 0.05) 70px
    );
    animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(35px, 35px); }
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border-top: 4px solid var(--primary);
}

.login-box h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 10px;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-box .logo-mark {
    width: 40px;
    height: 40px;
    font-size: 22px;
    flex-shrink: 0;
}

.login-box h2 {
    color: var(--gray);
    text-align: center;
    font-size: 16px;
    font-weight: normal;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.4rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: 0.85rem 1rem;
    font-size: 1rem;
}

.login-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f5f7fa;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    line-height: 1.6;
}

.login-info strong {
    color: #333;
}

/* Auth page (legacy) */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.auth-card {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-card h1 {
    font-size: 1.5rem;
    color: #1a1a2e;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

.auth-form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.auth-form input {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(88, 204, 2, 0.15);
}

.auth-form .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Page layout */
.page-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-bar .form-control {
    min-width: 180px;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.form-row .form-group {
    flex: 1;
    min-width: 160px;
}

.form-row .form-group.flex-2 {
    flex: 2;
    min-width: 280px;
}

.form-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
}

.form-tab {
    border: 1px solid var(--border);
    background: var(--light);
    color: var(--secondary);
    padding: 0.45rem 0.9rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.form-tab:hover {
    background: #fff;
}

.form-tab.active {
    background: #fff;
    color: var(--primary);
    border-bottom-color: #fff;
    font-weight: 600;
    margin-bottom: -1px;
    padding-bottom: calc(0.45rem + 1px);
}

.form-tab-panels {
    background: #fff;
}

.form-tab-panel {
    display: none;
    padding-top: 0.25rem;
}

.form-tab-panel.active {
    display: block;
}

.form-section {
    font-size: 0.9rem;
    color: #555;
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #eee;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.toggle-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fafbfc;
}

.toggle-field-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.toggle-field-info strong {
    font-size: 0.95rem;
    color: var(--secondary);
}

.toggle-field-hint {
    font-size: 0.82rem;
    color: var(--gray);
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 72px;
    height: 34px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    left: 4px;
    top: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.toggle-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
    user-select: none;
}

.toggle-label-off {
    right: 10px;
    opacity: 1;
}

.toggle-label-on {
    left: 10px;
    opacity: 0;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success, #22c55e);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(38px);
}

.toggle-switch input:checked ~ .toggle-label-off {
    opacity: 0;
}

.toggle-switch input:checked ~ .toggle-label-on {
    opacity: 1;
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
}

.detail-list dt {
    color: var(--gray);
    font-weight: 500;
}

.detail-list dd {
    color: #333;
}

.actions {
    white-space: nowrap;
}

.actions .btn {
    padding: 0.25rem 0.5rem;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card, .stat-card, .table-container {
    animation: fadeIn 0.5s ease-out;
}

.logo-mark {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(88, 204, 2, 0.3);
}

.logo-mark.has-img,
.home-empresa-banner .logo-mark.has-img,
.login-box .logo-mark.has-img {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0;
    padding: 0;
}

.logo-mark.has-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: transparent;
}

.logo-preview:has(> img) {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        height: 100vh;
        position: fixed;
    }

    .main-content {
        margin-left: 0;
        z-index: auto;
    }

    body:not(.sidebar-collapsed) .sidebar-overlay {
        display: block;
    }

    .app-container {
        flex-direction: row;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 105;
    border: none;
    padding: 0;
    cursor: pointer;
}

body.sidebar-collapsed .sidebar-overlay {
    display: none;
}

/* Input com botão de ação */
.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-with-action .form-control {
    flex: 1;
}

.btn-add-inline {
    width: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 700;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--light);
}

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--secondary);
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gray);
    padding: 0.25rem 0.5rem;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--light);
}

.modal-card.modal-mp-opcoes {
    max-width: 520px;
}

/* Dialog padrão (confirmação / alerta) */
.app-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 1rem;
    animation: appDialogFadeIn 0.15s ease;
}

.app-dialog-overlay[hidden] {
    display: none !important;
}

.app-dialog-card {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
    padding: 1.5rem 1.5rem 1.25rem;
    text-align: center;
    animation: appDialogSlideIn 0.2s ease;
}

.app-dialog-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.app-dialog-title {
    font-size: 1.15rem;
    color: var(--secondary);
    margin-bottom: 0.65rem;
}

.app-dialog-message {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-line;
    margin-bottom: 1.25rem;
}

.app-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.app-dialog-actions .btn {
    min-width: 110px;
}

.app-dialog-overlay.is-danger .app-dialog-confirm-btn {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.app-dialog-overlay.is-danger .app-dialog-confirm-btn:hover {
    filter: brightness(0.92);
}

.app-dialog-overlay.is-info .app-dialog-confirm-btn {
    background: var(--primary);
    border-color: var(--primary);
}

@keyframes appDialogFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes appDialogSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mp-opcoes-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.mp-opcoes-title {
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.mp-opcoes-grid {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.mp-opcoes-grid-head,
.mp-opcoes-item {
    display: grid;
    grid-template-columns: 1fr 90px;
    align-items: center;
    column-gap: 0.5rem;
}

.mp-opcoes-grid-head {
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--light);
    border-bottom: 1px solid var(--border);
}

.mp-opcoes-col-acoes {
    text-align: center;
}

.mp-opcoes-list {
    max-height: 220px;
    overflow-y: auto;
}

.mp-opcoes-item {
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.mp-opcoes-item:last-child {
    border-bottom: none;
}

.mp-opcoes-nome {
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.35;
}

.mp-opcoes-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
}

.mp-opcoes-empty {
    color: var(--gray);
    font-size: 0.85rem;
    text-align: center;
    padding: 0.85rem 0.75rem;
    margin: 0;
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.autocomplete-list[hidden] {
    display: none;
}

.autocomplete-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--light);
}

.autocomplete-item-title {
    font-size: 0.9rem;
    line-height: 1.35;
}

.autocomplete-item-sub {
    font-size: 0.78rem;
    color: var(--gray);
    margin-top: 0.15rem;
}

.autocomplete-empty {
    padding: 0.65rem 0.75rem;
    color: var(--gray);
    font-size: 0.85rem;
    text-align: center;
}

.vendas-pedido-top {
    grid-template-columns: minmax(0, 1fr) 148px 158px;
    align-items: end;
}

.vendas-vendedor-frete-row {
    grid-template-columns: minmax(320px, 1fr) minmax(260px, 340px);
    align-items: end;
    gap: 1rem;
}

.vendas-vendedor-group {
    min-width: 0;
}

.vendas-tipo-frete-group {
    min-width: 0;
}

.vendas-cliente-group {
    min-width: 0;
}

.vendas-campo-compact {
    min-width: 0;
    max-width: 158px;
}

.vendas-input-compact {
    font-size: 0.875rem;
    padding: 0.45rem 0.55rem;
}

.vendas-cliente-input {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--secondary);
    padding: 0.55rem 0.75rem;
}

.autocomplete-cliente-nome {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary);
}

.autocomplete-cliente-doc {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.2rem;
}

.autocomplete-produto-codigo {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--secondary);
}

.autocomplete-produto-desc {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.2rem;
}

@media (max-width: 900px) {
    .vendas-pedido-top {
        grid-template-columns: 1fr;
    }

    .vendas-vendedor-frete-row {
        grid-template-columns: 1fr;
    }

    .vendas-campo-compact {
        max-width: none;
    }
}

.vendas-item-pedido {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 68px 92px 76px 38px;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    align-items: end;
}

.vendas-item-produto {
    min-width: 0;
}

.vendas-item-campo {
    min-width: 0;
    max-width: 92px;
}

.vendas-item-campo:nth-child(4) {
    max-width: 76px;
}

.vendas-item-campo:nth-child(3) {
    max-width: 92px;
}

.vendas-item-campo:nth-child(2) {
    max-width: 68px;
}

.vendas-produto-input {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--secondary);
    padding: 0.52rem 0.7rem;
}

.vendas-item-input-compact {
    font-size: 0.875rem;
    padding: 0.42rem 0.45rem;
    text-align: right;
}

.vendas-item-pedido label {
    font-size: 0.8rem;
    white-space: nowrap;
}

.vendas-item-remove {
    padding: 0.38rem 0.5rem;
    align-self: end;
}

@media (max-width: 768px) {
    .vendas-item-pedido {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "produto produto"
            "qtd valor"
            "desc remove";
    }

    .vendas-item-pedido .vendas-item-produto { grid-area: produto; }
    .vendas-item-pedido .vendas-item-campo:nth-child(2) { grid-area: qtd; max-width: none; }
    .vendas-item-pedido .vendas-item-campo:nth-child(3) { grid-area: valor; max-width: none; }
    .vendas-item-pedido .vendas-item-campo:nth-child(4) { grid-area: desc; max-width: none; }
    .vendas-item-pedido .vendas-item-remove { grid-area: remove; justify-self: end; }
}

.modal-mp-opcoes .modal-footer {
    justify-content: stretch;
}

.modal-mp-opcoes .modal-footer .btn-success {
    width: 100%;
}

#modalEditar {
    display: none;
}

#modalEditar.active,
#modalEditarBom.active {
    display: flex;
}

#modalEditarBom {
    display: none;
}

/* Árvore BOM */
.bom-tree-container {
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
    font-size: 13px;
}

.bom-root {
    margin-bottom: 15px;
}

.bom-node {
    display: grid;
    grid-template-columns: 2fr 2fr auto;
    gap: 15px;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.bom-node:hover {
    box-shadow: 0 4px 8px rgba(88, 204, 2, 0.15);
    transform: translateX(2px);
}

.bom-node-root {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(88, 204, 2, 0.05), white);
    font-size: 15px;
}

.bom-node .badge {
    font-size: 10px;
    padding: 3px 8px;
}

.bom-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bom-codigo {
    color: var(--primary);
    font-family: monospace;
    font-size: 13px;
}

.bom-descricao {
    color: var(--dark);
    font-weight: 500;
}

.bom-dados {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 13px;
    flex-wrap: wrap;
}

.bom-qtd {
    background: var(--light);
    padding: 4px 10px;
    border-radius: 4px;
}

.bom-qtd small {
    color: var(--gray);
    font-size: 11px;
}

.bom-estoque {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.bom-estoque.ok {
    background: rgba(88, 204, 2, 0.1);
    color: var(--primary-dark);
}

.bom-estoque.baixo {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger);
}

.bom-custo {
    color: var(--dark);
    font-weight: 600;
}

.bom-acoes {
    display: flex;
    gap: 5px;
}

.bom-tree {
    list-style: none;
    margin: 10px 0 10px 30px;
    padding-left: 20px;
    border-left: 2px dashed rgba(88, 204, 2, 0.3);
}

.bom-tree .bom-item {
    margin-bottom: 8px;
    position: relative;
}

.bom-tree .bom-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 20px;
    width: 20px;
    height: 2px;
    background: rgba(88, 204, 2, 0.3);
}

.bom-tree.level-1 .bom-node {
    border-left-color: var(--info);
}

.bom-tree.level-2 .bom-node {
    border-left-color: var(--warning);
}

.bom-tree.level-3 .bom-node {
    border-left-color: var(--secondary);
}

@media (max-width: 768px) {
    .bom-node {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bom-tree {
        margin-left: 15px;
        padding-left: 10px;
    }
}

@media print {
    .sidebar,
    .topbar,
    .btn,
    .bom-acoes,
    .modal-overlay,
    form {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .bom-node {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .bom-tree {
        border-left: 1px solid #999;
    }
}

#modalEditarRoteiro {
    display: none;
}

#modalEditarRoteiro.active {
    display: flex;
}

/* Timeline Roteiro */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-marker {
    position: absolute;
    left: -40px;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(88, 204, 2, 0.3);
}

.timeline-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.timeline-header h4 {
    margin: 0;
    color: var(--dark);
    font-size: 16px;
}

.timeline-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px;
    background: var(--light);
    border-radius: 6px;
}

.detail-item {
    font-size: 13px;
    color: var(--gray);
}

.timeline-instrucoes {
    padding: 12px;
    background: rgba(88, 204, 2, 0.05);
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

.timeline-instrucoes p {
    margin: 8px 0 0 0;
    color: var(--dark);
}

.timeline-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .timeline {
        padding-left: 30px;
    }

    .timeline-marker {
        left: -30px;
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .timeline-details {
        flex-direction: column;
        gap: 8px;
    }
}

@media print {
    .timeline-actions {
        display: none !important;
    }
}

/* Campos de texto em maiúsculas */
input[type="text"]:not(.no-upper):not(.input-numeric):not(.input-money):not(.input-decimal),
textarea:not(.no-upper):not(.input-numeric) {
    text-transform: uppercase;
}

input[type="email"],
input[type="number"],
input[type="password"],
input.no-upper,
input.input-numeric,
input.input-money,
input.input-decimal,
textarea.no-upper,
textarea.input-numeric {
    text-transform: none;
}
