/* ============================================
   DESIGN SYSTEM - Controle de Pedidos Prefeitura
   ============================================ */

:root {
    /* Primary Colors - Deep Blue Government Theme */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Accent - Emerald */
    --accent-50: #ecfdf5;
    --accent-100: #d1fae5;
    --accent-400: #34d399;
    --accent-500: #10b981;
    --accent-600: #059669;

    /* Warning */
    --warning-50: #fff7ed;
    --warning-100: #ffedd5;
    --warning-400: #fb923c;
    --warning-500: #f97316;
    --warning-600: #ea580c;

    /* Danger */
    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    /* Info */
    --info-50: #f0f9ff;
    --info-400: #38bdf8;
    --info-500: #0ea5e9;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Surfaces */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #263348;
    --bg-input: #0f172a;
    --bg-sidebar: #0c1222;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar */
    --sidebar-width: 260px;
    --content-max-width: 1600px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: clamp(13px, 1vw, 16px);
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-400);
    text-decoration: none;
}

a:hover {
    color: var(--primary-300);
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0c1222 0%, #1a1a3e 50%, #0f172a 100%);
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: floatShape 20s infinite ease-in-out;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: var(--primary-600);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-500);
    bottom: -100px;
    left: -80px;
    animation-delay: -7s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: var(--warning-500);
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(24px);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(59, 130, 246, 0.08);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.login-logo .material-icons-round {
    font-size: 36px;
    color: white;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.input-icon {
    position: relative;
}

.input-icon .material-icons-round {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.input-icon input,
.input-icon select {
    padding-left: 44px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.error-message {
    background: var(--danger-50);
    color: var(--danger-600);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1px solid var(--danger-100);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn .material-icons-round {
    font-size: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--accent-400), var(--accent-500));
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-400), var(--danger-500));
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--warning-400), var(--warning-500));
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary-500);
    color: var(--primary-400);
    background: rgba(59, 130, 246, 0.05);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-sm .material-icons-round {
    font-size: 16px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app-screen {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header .material-icons-round {
    font-size: 32px;
    color: var(--primary-400);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-header small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-user {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(59, 130, 246, 0.03);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-menu {
    list-style: none;
    flex: 1;
    padding: 12px 12px;
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.06));
    color: var(--primary-400);
    font-weight: 600;
}

.sidebar-menu a .material-icons-round {
    font-size: 20px;
}

.sidebar-menu .badge {
    margin-left: auto;
    background: var(--danger-500);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    padding: 0 6px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    line-height: 1;
    flex-shrink: 0;
}
.sidebar-close-btn:hover { color: var(--text-primary); background: var(--border-color); }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.content {
    padding: 24px 32px;
    flex: 1;
    animation: fadeIn 0.3s ease;
    max-width: var(--content-max-width);
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   CARDS
   ============================================ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-base);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-card .icon-box {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card .icon-box .material-icons-round {
    font-size: 26px;
    color: white;
}

.icon-blue {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
}

.icon-green {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
}

.icon-orange {
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
}

.icon-red {
    background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
}

.icon-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-card .stat-info h3 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-card .stat-info .value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-info .sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Card panel */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 .material-icons-round {
    font-size: 22px;
    color: var(--primary-400);
}

.panel-body {
    padding: 24px;
}

.panel-body.no-padding {
    padding: 0;
}

/* ============================================
   TABLE
   ============================================ */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

tbody td {
    padding: 14px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-pendente_secretario {
    background: rgba(251, 146, 60, 0.12);
    color: var(--warning-400);
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.status-aprovado_secretario {
    background: rgba(56, 189, 248, 0.12);
    color: var(--info-400);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.status-aprovado_financas {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.status-finalizado {
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent-400);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-rejeitado_secretario,
.status-rejeitado_financas,
.status-rejeitado_coordenador {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger-400);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.status-expedido {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.status-recebido {
    background: rgba(45, 212, 191, 0.12);
    color: #2dd4bf;
    border: 1px solid rgba(45, 212, 191, 0.2);
}

.icon-teal {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease-out;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   ORDER DETAIL
   ============================================ */
.order-timeline {
    position: relative;
    padding-left: 32px;
    margin: 20px 0;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-color);
}

.timeline-step {
    position: relative;
    padding-bottom: 24px;
}

.timeline-step:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -25px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-card);
}

.timeline-dot.completed {
    background: var(--accent-500);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.timeline-dot.current {
    background: var(--primary-500);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    animation: pulse 2s infinite;
}

.timeline-dot.rejected {
    background: var(--danger-500);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    }

    50% {
        box-shadow: 0 0 16px rgba(59, 130, 246, 0.6);
    }
}

.timeline-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-content p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================
   STOCK BAR
   ============================================ */
.stock-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 4px;
}

.stock-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.stock-bar-fill.high {
    background: linear-gradient(90deg, var(--accent-500), var(--accent-400));
}

.stock-bar-fill.medium {
    background: linear-gradient(90deg, var(--warning-500), var(--warning-400));
}

.stock-bar-fill.low {
    background: linear-gradient(90deg, var(--danger-500), var(--danger-400));
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .material-icons-round {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    border: 1px solid;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-400);
    border-color: rgba(16, 185, 129, 0.2);
}

.toast-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
    border-color: rgba(239, 68, 68, 0.2);
}

.toast-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-400);
    border-color: rgba(59, 130, 246, 0.2);
}

/* ============================================
   ORDER ITEMS LIST (for creating orders)
   ============================================ */
.order-item-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px 40px;
    gap: 12px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.order-item-row:last-child {
    border-bottom: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 12px 16px;
    }

    .content {
        padding: 12px;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .order-item-row {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 6px;
        width: calc(100vw - 12px);
        max-width: 100%;
        max-height: calc(100vh - 12px);
        border-radius: var(--radius-lg);
    }

    /* Patrimônio: KPI cards 2 colunas no mobile */
    .pat-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .pat-kpi-card {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .pat-kpi-value { font-size: 1.4rem; }
    .pat-kpi-sub { font-size: 0.72rem; }

    /* Tabela: scroll horizontal */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Esconder colunas menos importantes no mobile */
    table th:nth-child(5),
    table td:nth-child(5),
    table th:nth-child(6),
    table td:nth-child(6),
    table th:nth-child(9),
    table td:nth-child(9),
    table th:nth-child(10),
    table td:nth-child(10),
    table th:nth-child(11),
    table td:nth-child(11) {
        display: none;
    }

    /* Topbar actions: compacto */
    .topbar-actions { gap: 6px; }
    .topbar-actions .btn span.material-icons-round + * { display: none; }

    /* Botões maiores para toque */
    .btn { min-height: 38px; }
    .btn-sm { min-height: 32px; padding: 4px 10px; }

    /* Filtros em coluna */
    .pat-report-panels { grid-template-columns: 1fr; }

    /* Item row no formulário de empenho */
    .emp-add-item-row { flex-wrap: wrap; gap: 6px; }
    .emp-add-item-row .form-group { flex: 1 1 100% !important; }
}

/* Ajustes para telas muito pequenas (< 480px) */
@media (max-width: 480px) {
    .cards-grid { grid-template-columns: 1fr; }
    .content { padding: 8px; }

    .pat-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .pat-kpi-card { padding: 10px 8px; }
    .pat-kpi-value { font-size: 1.2rem; }
    .pat-kpi-label { font-size: 0.7rem; }

    .topbar { padding: 10px 12px; }
    #pageTitle { font-size: 1rem; }

    /* Esconder ainda mais colunas */
    table th:nth-child(4),
    table td:nth-child(4),
    table th:nth-child(8),
    table td:nth-child(8) {
        display: none;
    }

    /* Modal ocupa tela toda */
    .modal {
        margin: 0;
        width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .modal-overlay { align-items: flex-end; }
}

/* ============================================
   RESPONSIVE - MEDIUM (769px - 1199px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1199px) {
    :root { --sidebar-width: 220px; }

    .topbar { padding: 14px 20px; }
    .content { padding: 20px 24px; }

    .sidebar-header { padding: 18px 16px; }
    .sidebar-menu { padding: 8px; }
    .sidebar-menu a { padding: 9px 12px; font-size: 0.875rem; }

    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

    .stat-card { padding: 16px; }

    table { font-size: 0.8rem; }
    th, td { padding: 8px 10px; }
}

/* ============================================
   RESPONSIVE - LARGE (1200px - 1599px)
   ============================================ */
@media (min-width: 1200px) and (max-width: 1599px) {
    :root { --sidebar-width: 250px; }

    .content { padding: 24px 28px; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
}

/* ============================================
   RESPONSIVE - EXTRA LARGE (1600px+)
   ============================================ */
@media (min-width: 1600px) {
    :root { --sidebar-width: 280px; }

    .content { padding: 32px 40px; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

    .topbar { padding: 18px 40px; }

    table { font-size: 0.9rem; }
    th, td { padding: 12px 16px; }

    .stat-card { padding: 28px; }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ============================================
   MISC UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.8125rem;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.gap-2 {
    gap: 8px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.highlight-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-400);
}

.rejection-reason {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 12px;
}

.rejection-reason strong {
    color: var(--danger-400);
    font-size: 0.8125rem;
}

.rejection-reason p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}
/* ═══════════════════════════════════════════════════════════════
   MÓDULO PATRIMÔNIO
═══════════════════════════════════════════════════════════════ */

/* Badge genérico */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--text-secondary);
}
.badge-green { background: rgba(16,185,129,0.12); color: #059669; }

/* Conservação badge */
.conservacao-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}
.cons-otimo   { background: rgba(16,185,129,0.12); color: #059669; }
.cons-bom     { background: rgba(59,130,246,0.12);  color: #2563eb; }
.cons-regular { background: rgba(245,158,11,0.12);  color: #d97706; }
.cons-ruim    { background: rgba(239,68,68,0.12);   color: #dc2626; }
.cons-inservivel { background: rgba(107,114,128,0.12); color: #6b7280; }

/* Tabela patrimônio */
.pat-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.pat-table th { padding: 8px 10px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); text-align: left; font-weight: 600; font-size: 0.75rem; color: var(--text-secondary); }
.pat-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.pat-table tr:last-child td { border-bottom: none; }

/* Info grid para detalhes */
.pat-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.pat-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pat-info-grid span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pat-info-grid strong {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Seções de informação */
.pat-info-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.pat-info-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.875rem;
    color: var(--primary-600);
    display: flex;
    align-items: center;
    gap: 6px;
}
.pat-info-section h4 .material-icons-round { font-size: 16px; }

/* Detalhe header com foto */
.pat-detail-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    align-items: flex-start;
}
.pat-detail-header .flex-1 { flex: 1; }

/* Foto do bem */
.pat-foto {
    width: 160px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--gray-200);
    cursor: pointer;
    transition: transform 0.2s;
}
.pat-foto:hover { transform: scale(1.05); }
.pat-foto-container { flex-shrink: 0; }
.pat-foto-placeholder {
    width: 160px;
    height: 120px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.pat-foto-placeholder .material-icons-round { font-size: 32px; opacity: 0.4; }
.pat-foto-placeholder p { font-size: 0.7rem; margin: 4px 0 0; }

/* Upload de foto no formulário */
.pat-foto-upload {
    cursor: pointer;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    transition: border-color 0.2s, background 0.2s;
}
.pat-foto-upload:hover { border-color: var(--primary-400); background: var(--primary-50); }
.pat-foto-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}
.pat-foto-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}
.pat-foto-empty .material-icons-round { font-size: 40px; opacity: 0.4; }
.pat-foto-empty p { font-size: 0.8125rem; margin: 0; }

/* Seções do formulário */
.pat-form-sections { display: flex; flex-direction: column; gap: 12px; }
.pat-form-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.pat-form-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.875rem;
    color: var(--primary-600);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.pat-form-section h4 .material-icons-round { font-size: 16px; }

/* Info mini-grid (topo do empenho) */
.pat-info-grid.pat-info-4col {
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 600px) {
    .pat-info-grid { grid-template-columns: repeat(2, 1fr); }
    .pat-detail-header { flex-direction: column; }
    .pat-foto, .pat-foto-placeholder { width: 100%; height: 140px; }
}

/* Utility */
.ml-2 { margin-left: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.text-sm { font-size: 0.875rem; }

/* ═══════════════════════════════════════════════════════════════
   RELATÓRIO PATRIMÔNIO — NOVO LAYOUT
═══════════════════════════════════════════════════════════════ */

/* KPI cards grandes */
.pat-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.pat-kpi-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}
.pat-kpi-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 100%;
    opacity: 0.06;
    background: currentColor;
}
.pat-kpi-blue  { border-color: #3b82f6; color: #3b82f6; }
.pat-kpi-green { border-color: #10b981; color: #10b981; }
.pat-kpi-red   { border-color: #ef4444; color: #ef4444; }
.pat-kpi-orange{ border-color: #f59e0b; color: #f59e0b; }
.pat-kpi-purple{ border-color: #8b5cf6; color: #8b5cf6; }

.pat-kpi-icon { margin-bottom: 4px; }
.pat-kpi-icon .material-icons-round { font-size: 24px; }
.pat-kpi-info { display: flex; flex-direction: column; }
.pat-kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.pat-kpi-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.pat-kpi-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* Painéis laterais do relatório */
.pat-report-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 700px) { .pat-report-panels { grid-template-columns: 1fr; } }

/* Barras de grupo */
.pat-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.pat-bar-label { width: 150px; font-size: 0.8rem; color: var(--text-primary); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pat-bar-track { flex: 1; height: 10px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.pat-bar-fill  { height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); border-radius: 99px; transition: width 0.4s; }
.pat-bar-count { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); min-width: 24px; text-align: right; }

/* Linha de situação */
.pat-sit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}
.pat-sit-row:last-child { border-bottom: none; }
.pat-sit-info { font-size: 0.875rem; }
.pat-sit-info strong { color: var(--text-primary); }

/* Contador de filtro */
.pat-filter-count {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Linha de adição de item no formulário de empenho */
.emp-add-item-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: var(--gray-800);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 8px;
}

/* Tabela melhorada */
.pat-num-link {
    color: var(--primary-600);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.pat-num-link:hover { color: var(--primary-700); }
.pat-desc-cell { max-width: 220px; }
.pat-grupo-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--text-secondary);
    white-space: nowrap;
}
.mono { font-family: monospace; font-size: 0.8rem; }
.text-right { text-align: right !important; }
.pat-table-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: transform 0.2s;
}
.pat-table-thumb:hover { transform: scale(2.5); z-index: 10; position: relative; }

/* ── Mobile card layout: Empenhos ── */
.mob-card-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.mob-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.mob-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.mob-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
}
.mob-card-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.mob-card-info { margin-bottom: 10px; }
.mob-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.82rem;
}
.mob-info-row:last-child { border-bottom: none; }
.mob-info-label { color: var(--text-secondary); font-weight: 500; }
.mob-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.mob-card-actions .btn { flex: 1; min-width: 0; font-size: 0.82rem; padding: 8px 10px; justify-content: center; }

/* ── Mobile card layout: Patrimônio (bens) ── */
#patCards { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.mob-pat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.mob-pat-card-sem-num {
    border-left: 4px solid #dc2626;
    background: #fff9f9;
}
.mob-pat-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.mob-pat-num-block { display: flex; flex-direction: column; gap: 3px; }
.mob-pat-sem-num {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #dc2626;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 3px 10px;
    border-radius: 20px;
}
.mob-pat-num {
    font-size: 1rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--primary-600);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.mob-pat-grupo {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    width: fit-content;
}
.mob-pat-desc {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.35;
}
.mob-pat-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-bottom: 10px;
}
.mob-pat-meta-item {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.mob-pat-meta-item strong { color: var(--text-primary); display: block; font-size: 0.8rem; }
.mob-pat-foto {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    flex-shrink: 0;
}
.mob-pat-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.mob-pat-actions .btn { flex: 1; min-width: 0; font-size: 0.8rem; padding: 8px 10px; justify-content: center; }

/* ── Pat filter grid ── */
.pat-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (min-width: 769px) {
    .pat-filter-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
@media (max-width: 480px) {
    .pat-filter-grid { grid-template-columns: 1fr; }
    .mob-pat-meta { grid-template-columns: 1fr; }
    .mob-card-actions .btn, .mob-pat-actions .btn { font-size: 0.78rem; padding: 8px; }
}
