:root {
    --transition-speed: 0.3s;
    --sidebar-width: 220px;
    --topbar-height: 64px;
}

body[data-theme="light"] {
    color-scheme: light;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --danger: #ef4444;
    --success: #22c55e;
    --success-dark: #16a34a;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #0ea5e9;
    --info-dark: #0284c7;
    --background-gradient: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    --text-color: #0f172a;
    --muted-text: #16181a;
    --surface-color: #ffffff;
    --surface-border: rgba(15, 23, 42, 0.08);
    --surface-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    --topbar-bg: rgba(255, 255, 255, 0.95);
    --topbar-text: #0f172a;
    --topbar-border: 1px solid rgba(15, 23, 42, 0.08);
    --topbar-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    --sidebar-bg: #f8fafc;
    --sidebar-border: 1px solid rgba(15, 23, 42, 0.06);
    --sidebar-text: #0f172a;
    --nav-link-color: #0f172a;
    --nav-hover-bg: rgba(37, 99, 235, 0.08);
    --nav-hover-text: #1d4ed8;
    --nav-active-bg: rgba(37, 99, 235, 0.15);
    --nav-active-text: #1d4ed8;
    --nav-section-title-color: #64748b;
    --nav-icon-color: #64748b;
    --tag-bg: #eef2ff;
    --tag-text: #1d4ed8;
    --secondary-bg: #e2e8f0;
    --secondary-bg-hover: #d0d8ee;
    --secondary-color: #0f172a;
    --inverse-text: #ffffff;
    --toggle-bg: rgba(37, 99, 235, 0.1);
    --toggle-border: 1px solid rgba(37, 99, 235, 0.25);
    --toggle-color: #1d4ed8;
    --card-bg: #f8fafc;
    --card-border: #e2e8f0;
    --card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    --list-item-bg: #f8fafc;
    --list-item-border: #e2e8f0;
    --modal-bg: #f8fafc;
    --modal-border: rgba(148, 163, 184, 0.35);
    --section-title-color: #1e293b;
    --surface-backdrop: rgba(15, 23, 42, 0.55);
    --table-header-bg: #1e293b;
    --table-hover-bg: rgba(37, 99, 235, 0.05);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --primary: #f97316;
    --primary-dark: #ea580c;
    --secondary: #475569;
    --danger: #f87171;
    --success: #34d399;
    --success-dark: #22c55e;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #38bdf8;
    --info-dark: #0ea5e9;
    --background-gradient: linear-gradient(135deg, #0b0b0f 0%, #111827 100%);
    --text-color: #e2e6eb;
    --muted-text: #94a3b8;
    --surface-color: rgba(17, 24, 39, 0.94);
    --surface-border: rgba(15, 23, 42, 0.6);
    --surface-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
    --topbar-bg: rgba(10, 12, 18, 0.95);
    --topbar-text: #f8fafc;
    --topbar-border: 1px solid rgba(148, 163, 184, 0.08);
    --topbar-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --sidebar-bg: rgba(15, 23, 42, 0.9);
    --sidebar-border: 1px solid rgba(148, 163, 184, 0.08);
    --sidebar-text: #e2e8f0;
    --nav-link-color: #e2e8f0;
    --nav-hover-bg: rgba(249, 115, 22, 0.1);
    --nav-hover-text: #f97316;
    --nav-active-bg: rgba(249, 115, 22, 0.15);
    --nav-active-text: #f97316;
    --nav-section-title-color: #94a3b8;
    --nav-icon-color: #94a3b8;
    --tag-bg: rgba(249, 115, 22, 0.15);
    --tag-text: #fed7aa;
    --secondary-bg: rgba(148, 163, 184, 0.12);
    --secondary-bg-hover: rgba(148, 163, 184, 0.25);
    --secondary-color: #e2e8f0;
    --inverse-text: #0b0f1a;
    --toggle-bg: rgba(249, 115, 22, 0.14);
    --toggle-border: 1px solid rgba(249, 115, 22, 0.35);
    --toggle-color: #fb923c;
    --card-bg: rgba(30, 41, 59, 0.82);
    --card-border: rgba(148, 163, 184, 0.16);
    --card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --list-item-bg: rgba(30, 41, 59, 0.75);
    --list-item-border: rgba(148, 163, 184, 0.12);
    --modal-bg: rgba(17, 24, 39, 0.96);
    --modal-border: rgba(148, 163, 184, 0.25);
    --section-title-color: #e2e8f0;
    --surface-backdrop: rgba(3, 7, 18, 0.6);
    --table-header-bg: rgba(15, 23, 42, 0.95);
    --table-hover-bg: rgba(249, 115, 22, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv03' on, 'cv04' on, 'cv11' on;
    margin: 0;
    padding: 0;
    background: var(--background-gradient);
    color: var(--text-color);
    transition: background 0.3s ease, color 0.3s ease;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

/* Login page layout */
body:not(:has(.sidebar)) {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

a {
    color: var(--primary);
    transition: color var(--transition-speed) ease;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============ TOPBAR ============ */
.topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    gap: 24px;
    border-bottom: var(--topbar-border);
    box-shadow: var(--topbar-shadow);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 30;
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--surface-border);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    font-size: 1.2rem;
}

.sidebar-toggle:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.sidebar-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.topbar-brand {
    flex: 0 0 auto;
}

.topbar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--topbar-text);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
    transition: color var(--transition-speed) ease;
}

.topbar-brand a:hover {
    color: var(--primary);
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    margin-left: auto;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--surface-border);
    background: transparent;
    color: var(--topbar-text);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
}

.user-menu-trigger:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-trigger i {
    font-size: 0.7rem;
    transition: transform var(--transition-speed) ease;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-speed) ease;
    z-index: 100;
}

.user-menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    border-bottom: 1px solid var(--surface-border);
}

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

.user-menu-item:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.user-menu-item i {
    width: 16px;
    text-align: center;
}

/* ============ SIDEBAR ============ */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    background: var(--sidebar-bg);
    border-right: var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
    width: var(--sidebar-width);
    transition: all var(--transition-speed) ease;
    z-index: 20;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}

.sidebar-nav {
    padding: 20px 0;
    list-style: none;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: var(--nav-link-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.93rem;
    letter-spacing: 0.3px;
}

.nav-item:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.nav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    border-left-color: var(--primary);
}

.nav-section {
    padding: 12px 0;
    border-top: 1px solid var(--surface-border);
    margin: 12px 0 0;
}

.nav-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nav-section-title-color);
    margin-bottom: 4px;
}

.nav-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--nav-link-color);
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    text-align: left;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

.nav-group:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.nav-group.active {
    color: var(--nav-active-text);
    border-left-color: var(--primary);
}

.nav-icon {
    width: 20px;
    text-align: center;
    color: var(--nav-icon-color);
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-arrow {
    width: 16px;
    text-align: center;
    color: var(--nav-icon-color);
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
    flex-shrink: 0;
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
    background: var(--nav-hover-bg);
}

.nav-submenu.open {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 48px;
    color: var(--nav-link-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

.nav-subitem:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
}

.nav-subitem.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-subitem i {
    width: 16px;
    text-align: center;
}

/* ============ MAIN WRAPPER ============ */
.main-wrapper {
    grid-column: 2;
    grid-row: 2;
    overflow-y: auto;
    overflow-x: hidden;
    transition: grid-column var(--transition-speed) ease;
}

.main-wrapper.sidebar-collapsed {
    grid-column: 1 / -1;
}

/* ============ CONTAINER ============ */
.container {
    width: min(100%, calc(100% - 48px));
    margin: 24px auto;
    background-color: var(--surface-color);
    padding: 36px 40px;
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    border: 1px solid var(--surface-border);
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    min-height: calc(100vh - var(--topbar-height) - 48px);
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1;
    grid-row: 1 / -1;
    margin: 0;
    padding: 24px;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.flash {
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 12px;
    font-weight: 500;
    animation: slideInDown 0.3s ease;
}

.flash.error { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); }
.flash.success { background-color: rgba(34, 197, 94, 0.15); color: var(--success); }
.flash.warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.flash.info { background-color: rgba(37, 99, 235, 0.15); color: var(--primary); }

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

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #e2e8f0;
    color: #0f172a;
}

.status-ativo {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}

.status-planejado {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.status-encerrado {
    background: rgba(148, 163, 184, 0.4);
    color: #1f2937;
}

.status-aberta {
    background: rgba(96, 165, 250, 0.25);
    color: #1d4ed8;
}

.status-em_andamento {
    background: rgba(234, 179, 8, 0.25);
    color: #854d0e;
}

.status-concluida {
    background: rgba(34, 197, 94, 0.2);
    color: #166534;
}

.status-disponivel {
    background: rgba(34, 197, 94, 0.18);
    color: #166534;
}

.status-em_uso {
    background: rgba(59, 130, 246, 0.22);
    color: #1d4ed8;
}

/* ============ THEME TOGGLE ============ */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--toggle-border);
    background: var(--toggle-bg);
    color: var(--toggle-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-speed) ease;
}

.theme-toggle:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover-text);
    border-color: transparent;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle i {
    font-size: 1rem;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.94rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left var(--transition-speed) ease;
    pointer-events: none;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--secondary-bg);
    color: var(--secondary-color);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    background: var(--secondary-bg-hover);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-info:hover {
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

/* ============ PAGE HEADER ============ */
.back-button {
    margin-bottom: 24px;
}

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

.page-header > div:first-child {
    flex: 1;
    min-width: 200px;
}

.page-header h1,
.page-header h2 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--section-title-color);
}

.page-header p {
    margin: 0;
    color: var(--muted-text);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
}

.page-header-actions {
    display: flex;
    align-items: stretch;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-header-actions .btn {
    align-self: center;
}

.page-header-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.summary-card-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: stretch;
}

.summary-card {
    min-width: 220px;
    display: grid;
    gap: 4px;
    text-align: right;
}

.summary-card p {
    margin: 0;
    color: var(--muted-text);
}

.summary-card strong {
    font-size: 1.8rem;
    color: var(--primary);
}

.summary-card.summary-card--compact {
    min-width: 168px;
    padding: 12px 16px;
    display: grid;
    gap: 6px;
    align-content: start;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: 14px;
}

.summary-card.summary-card--compact .summary-title {
    font-size: 0.95rem;
}

.summary-card.summary-card--compact p {
    font-size: 0.85rem;
    color: var(--muted-text);
}

.summary-card.summary-card--compact strong {
    font-size: 1.5rem;
    color: var(--text-color);
}

.summary-card.summary-card--compact .movement-summary {
    width: 100%;
    gap: 8px;
}

.summary-card.summary-card--compact .movement-summary span {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 10px;
    background: var(--secondary-bg);
    color: var(--secondary-color);
}

.summary-card.summary-card--compact .movement-summary span span {
    color: var(--muted-text);
    font-weight: 500;
}

.summary-card.summary-card--compact .movement-summary span strong {
    font-size: 1.1rem;
    color: var(--text-color);
}

.summary-title {
    margin: 0;
    font-size: 1rem;
    color: var(--muted-text);
}

.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.tab-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.tab-button {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: white;
    color: #1e293b;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tab-button:hover,
.tab-button:focus {
    background: #e2e8f0;
    outline: none;
}

.tab-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.tab-button.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.tab-panels {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tab-panel {
    display: none;
}

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


.pagination-container {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    color: #475569;
    font-weight: 500;
}

.pagination-links {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #1e293b;
    font-weight: 600;
    text-decoration: none;
    background: white;
    transition: background 0.2s ease, color 0.2s ease;
}

.pagination-link:hover {
    background: #e2e8f0;
}

.pagination-link.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
    cursor: default;
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.pagination-page-size label {
    color: #475569;
    font-weight: 500;
}

.pagination-page-size select {
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 6px 10px;
    background: white;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
}

.pagination-page-size select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin: 24px 0;
}

.stat-card {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.stat-card span {
    display: block;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ============ TABLES ============ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
}

thead {
    background: var(--table-header-bg);
    color: white;
}

thead tr:first-child th:first-child {
    border-radius: 12px 0 0 0;
}

thead tr:first-child th:last-child {
    border-radius: 0 12px 0 0;
}

th {
    padding: 16px 14px;
    text-align: left;
    vertical-align: middle;
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

td {
    padding: 16px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--surface-border);
    font-weight: 400;
    font-size: 0.94rem;
}

tbody tr {
    transition: background var(--transition-speed) ease;
}

tbody tr:hover {
    background: var(--table-hover-bg);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:last-child td:first-child {
    border-radius: 0 0 0 12px;
}

tbody tr:last-child td:last-child {
    border-radius: 0 0 12px 0;
}

.table-text-clip {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.35;
    max-width: 220px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.table-actions .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.table-column-actions {
    text-align: right;
}

.table-column-actions .table-actions {
    justify-content: flex-end;
}

.table-actions .form-hint {
    margin: 0;
}

.user-info strong {
    display: block;
    font-size: 1.05rem;
}

.user-info .form-hint {
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.18);
    color: var(--secondary);
}

.badge-info {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary);
    transition: background 0.2s ease, color 0.2s ease;
}

.badge-info:hover,
.badge-info:focus {
    background: rgba(37, 99, 235, 0.25);
    color: var(--primary-dark);
}

.equipamentos-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

form {
    display: grid;
    gap: 16px;
}

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

.equipment-section {
    display: grid;
    gap: 16px;
    padding: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.equipment-section__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.equipment-section__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

.form-inline {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.form-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

label {
    font-weight: 600;
    margin-bottom: 4px;
    display: inline-block;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #cbd5f5;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-search {
    display: grid;
    gap: 8px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.movement-section {
    display: grid;
    gap: 24px;
}

.movement-summary {
    display: grid;
    gap: 10px;
}

.movement-summary span {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 600;
}

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

.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.45), rgba(248, 250, 252, 0.9));
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.summary-card[data-variant="entrada"] .summary-icon {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.summary-card[data-variant="saida"] .summary-icon {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.summary-card[data-variant="saldo"] .summary-icon {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.summary-card[data-variant="disponivel"] .summary-icon {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
}

.summary-label {
    display: block;
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
}

.summary-detail {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 0.85rem;
}

.movement-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.movement-form {
    
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    padding: 18px;
    display: grid;
    gap: 16px;
}

.movement-form footer {
    display: flex;
    justify-content: flex-end;
}

.movement-form h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
}

.form-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.form-card {
    display: grid;
    gap: 16px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    min-width: 220px;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--surface-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: absolute;
    inset: 0;
}

.modal-content {
    position: relative;
    width: min(620px, 100%);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--modal-bg);
    border-radius: 16px;
    border: 1px solid var(--modal-border);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
    padding: 0 24px 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 24px 0 16px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.modal-body {
    padding: 0;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}

.modal-delete {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 0 0;
}

.modal-delete.is-hidden {
    display: none;
}

.cards-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.user-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.85rem;
}

.section-title {
    font-size: 1.25rem;
    margin: 24px 0 12px;
    color: var(--section-title-color);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

ul li {
    background: var(--list-item-bg);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--list-item-border);
}

@media (max-width: 1024px) {
    .container {
        padding: 28px 24px;
    }

    .navbar {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px;
    }

    .navbar-toggle {
        display: inline-flex;
    }

    .navbar-content {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        width: 100%;
        margin-top: 6px;
        padding: 16px;
        border: 1px solid var(--surface-border);
        background: var(--surface-color);
        border-radius: 16px;
        box-shadow: var(--surface-shadow);
    }

    .navbar-content.is-open {
        display: flex;
    }

    .navbar-user {
        justify-content: flex-start;
        width: 100%;
    }

    .theme-toggle {
        width: 100%;
        justify-content: center;
    }

    .navbar-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
    }

    .nav-link {
        justify-content: flex-start;
        width: 100%;
    }

    .nav-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .nav-link-group::after {
        display: none;
    }

    .nav-dropdown {
        position: static;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        border: none;
        padding: 0;
        margin-top: 0;
        box-shadow: none;
        background: transparent;
        gap: 6px;
    }

    .nav-dropdown a {
        background: rgba(37, 99, 235, 0.06);
        border-radius: 12px;
        padding: 10px 14px;
        width: 100%;
    }

    .nav-link-logout {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 24px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header-actions,
    .page-header-buttons,
    .summary-card-group {
        width: 100%;
        justify-content: flex-start;
    }

    .summary-card {
        text-align: left;
    }

    .form-actions,
    .form-inline {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 12px;
    }

    .table-responsive {
        margin: 0 -16px;
        padding: 0 16px;
    }

    table {
        font-size: 0.9rem;
    }

    th,
    td {
        padding: 12px;
    }
}

@media (max-width: 540px) {
    .navbar {
        padding: 12px 16px;
    }

    .navbar-brand a {
        font-size: 1rem;
    }

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

    .navbar-user {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .table-responsive {
        margin: 0 -12px;
        padding: 0 12px;
    }
}

.nota-detalhes {
    background: white;
    border: 1px solid #1e293b;
    padding: 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nota-detalhes__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}

.nota-detalhes__title {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #334155;;
}

.nota-detalhes__subtitle {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: #334155;
}

.nota-detalhes__header-actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nota-detalhes__total {
    min-width: 180px;
    border: 1px solid #1e293b;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
}

.nota-detalhes__total span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.nota-detalhes__total strong {
    font-size: 1.35rem;
    color: #1d4ed8;
}

.nota-detalhes__section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nota-grid {
    display: grid;
    gap: 12px;
}

.nota-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.nota-grid--5 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.nota-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nota-field {
    border: 1px solid #1e293b;
    padding: 12px 14px;
    min-height: 44px;
    background: white;
    display: flex;
    align-items: flex-start;
}

.nota-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
}

.nota-value {
    font-size: 0.92rem;
    color: #0f172a;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    width: 100%;
}

.nota-text-truncate {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    width: 100%;
}

.nota-section-card {
    border: 1px solid #1e293b;
    padding: 20px;
    border-radius: 12px;
    background: white;
}

.nota-section-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.nota-section-card__header .btn {
    white-space: nowrap;
}

.nota-section-card__title {
    margin: 0;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #334155;
}

.nota-equipamentos[hidden] {
    display: none !important;
}

.nota-equipamentos.is-visible {
    animation: fadeIn 0.2s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nota-section-card .table-responsive {
    margin-top: 16px;
}

.nota-section-card .nota-table {
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
    border: 1px solid #1e293b;
}

.nota-section-card .nota-table thead {
    background: #f8fafc;
    color: #0f172a;
}

.nota-section-card .nota-table th,
.nota-section-card .nota-table td {
    border: 1px solid #1e293b;
    background: white;
    padding: 8px 10px;
}

.nota-section-card .nota-table tbody tr:nth-child(even) {
    background: white;
}

.nota-section-card .nota-table tbody tr:hover {
    background: #e2e8f0;
}

.nota-empty {
    margin: 16px 0 0;
    color: #475569;
    font-style: italic;
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .sidebar.collapsed {
        position: fixed;
        left: 0;
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
        width: var(--sidebar-width);
        z-index: 25;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    }
    
    .main-wrapper {
        grid-column: 1 / -1 !important;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 240px;
        --topbar-height: 56px;
    }

    body {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-brand a {
        font-size: 1rem;
    }

    .brand-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .topbar-right {
        gap: 12px;
    }

    .user-menu-trigger {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .user-name {
        display: none;
    }

    .theme-toggle-label {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
        width: var(--sidebar-width);
        z-index: 25;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform var(--transition-speed) ease;
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .main-wrapper {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .container {
        width: calc(100% - 32px);
        padding: 20px;
        margin: 16px auto;
    }

    .page-header {
        flex-direction: column;
        gap: 16px;
    }

    .page-header h1,
    .page-header h2 {
        font-size: 1.5rem;
    }

    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .page-header-actions .summary-card {
        min-width: 150px;
    }

    table {
        font-size: 0.9rem;
    }

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

    .table-actions {
        gap: 4px;
    }

    .table-actions .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    :root {
        --topbar-height: 48px;
        --sidebar-width: 200px;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar-brand a {
        font-size: 0.9rem;
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .brand-icon {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .brand-text {
        display: none;
    }

    .topbar-right {
        gap: 8px;
    }

    .theme-toggle {
        padding: 6px 10px;
    }

    .container {
        width: calc(100% - 24px);
        padding: 16px;
        margin: 12px auto;
        min-height: calc(100vh - var(--topbar-height) - 24px);
    }

    .page-header {
        gap: 12px;
    }

    .page-header h1,
    .page-header h2 {
        font-size: 1.25rem;
    }

    .nav-section-title {
        font-size: 0.7rem;
        padding: 6px 16px;
    }

    .nav-item,
    .nav-group,
    .nav-subitem {
        padding-left: 16px;
        padding-right: 16px;
        font-size: 0.9rem;
    }

    table {
        font-size: 0.85rem;
    }

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

    .table-text-clip {
        max-width: 150px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        gap: 4px;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .nota-detalhes {
        padding: 16px;
    }

    .nota-detalhes__header-actions {
        justify-content: flex-start;
    }

    .nota-detalhes__total {
        width: 100%;
    }

    .nota-grid {
        gap: 8px;
    }
}
