:root {
    --bg-color: #F5F5F7; /* Apple Light Gray Background */
    --card-bg: #FFFFFF;
    --text-primary: #1D1D1F; /* Apple Text Black */
    --text-secondary: #86868B; /* Apple Text Gray */
    --primary-color: #0071E3; /* Apple Blue */
    --success-color: #34C759; /* Apple Green */
    --warning-color: #FF9F0A; /* Apple Orange */
    --danger-color: #FF3B30; /* Apple Red */
    --border-color: #D2D2D7;
    --separator-color: #E5E5EA;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll; /* Scrollbar sempre visível — evita pulo lateral */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Entrance Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding: 40px 20px;
    line-height: 1.47059;
    letter-spacing: -0.022em;
}

.container {
    margin: 0 auto;
}

header {
    position: relative;
    margin: -40px -20px 40px -20px;
    padding: 36px 40px;
    background: linear-gradient(180deg, #f0f4ff 0%, var(--bg-color) 100%);
    overflow: hidden;
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.1s;
}

.header-bg-pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(0, 113, 227, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.header-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 1;
}

.header-logo {
    height: 65px;
    width: auto;
    object-fit: contain;
    padding: 10px 14px;
    /* background: rgba(255, 255, 255, 0.85); */
    /* backdrop-filter: blur(10px); */
    border-radius: 14px;
    /* border: 1px solid rgba(0, 113, 227, 0.08); */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); */
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-text {
    flex: 1;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.01em;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 113, 227, 0.06);
    border: 1px solid rgba(0, 113, 227, 0.1);
    border-radius: 10px;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-badge svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Staggered card entrance */
.stat-card {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}
.stat-card:nth-child(1) { animation-delay: 0.2s; }
.stat-card:nth-child(2) { animation-delay: 0.3s; }
.stat-card:nth-child(3) { animation-delay: 0.4s; }
.stat-card:nth-child(4) { animation-delay: 0.5s; }

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.stat-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.stat-icon-wrapper svg {
    color: white;
}

/* Icon Colors */
.icon-blue { background-color: var(--primary-color); }
.icon-green { background-color: var(--success-color); }
.icon-orange { background-color: var(--warning-color); }
.icon-red { background-color: var(--danger-color); }

.stat-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* Remove old specific colors for text, just keep standard or use if desired */
#active-stat .value, #warning-stat .value, #critical-stat .value {
    color: var(--text-primary);
}

.filters {
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
    animation-delay: 0.6s;
}

.filter-selects {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.filter-selects select {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    border-radius: 12px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-selects select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0,113,227,0.15);
}

/* Stat cards clickable */
.stat-card {
    cursor: pointer;
}

.stat-card.active-filter {
    box-shadow: 0 0 0 3px var(--primary-color);
}

#search {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--border-color);
    background-color: #FFFFFF;
    border-radius: 12px;
    font-size: 17px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-primary);
}

#search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0,113,227,0.15);
}

#search::placeholder {
    color:  #86868B;
}

.table-container {
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
    animation-delay: 0.7s;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background-color: #FAFAFA;
    border-bottom: 1px solid var(--separator-color);
}

th {
    padding: 16px 24px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--separator-color);
    vertical-align: middle;
    font-size: 15px;
}

tr:last-child td {
    border-bottom: none;
}

/* Staggered row entrance animation */
tbody tr {
    opacity: 0;
    animation: fadeInUp 0.35s ease-out forwards;
    animation-delay: calc(var(--row-index, 0) * 0.04s);
}

tr:hover {
    background-color: #F5F5F7;
    transition: background-color 0.2s ease;
}

.company-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.cnpj {
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: -0.01em;
}

.badge {
    padding: 6px 12px;
    border-radius: 999px; /* Pill shape */
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    white-space: nowrap;
    text-align: center;
    width: 140px; 
    letter-spacing: 0.02em;
}

/* Apple System Colors for Badges */
.status-ativa { background-color: rgba(52, 199, 89, 0.15); color: #248A3D; } /* Green */
.status-vencendo { background-color: rgba(255, 149, 0, 0.15); color: #C97200; } /* Orange */
.status-vencida { background-color: rgba(255, 59, 48, 0.15); color: #D70015; } /* Red */
.status-sem { background-color: rgba(255, 59, 48, 0.15); color: #D70015; } /* Red */

/* New Consult Button Style */
.button {
  color: white;
  background-color: #3171DF; /* Requested Blue */
  font-weight: 500;
  border-radius: 0.5rem;
  font-size: 0.9rem; /* Slightly smaller to fit table */
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  border: none;
  transition: background-color 0.2s;
}

.button:hover {
  background-color: #2558b0; /* Darker blue for hover */
}

.button svg {
  display: inline;
  width: 1.2rem;
  height: 1.2rem;
  margin-right: 0.5rem;
  color: white;
}

.button:focus svg {
  animation: pulse_icon 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pulse_icon {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}


/* ... existing styles ... */

/* Custom Modal - macOS Style */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Dimmed background */
    backdrop-filter: blur(5px); /* Blur effect */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: rgba(255, 255, 255, 0.95); /* High opacity for readability */
    backdrop-filter: blur(20px); /* Glassmorphism */
    border-radius: 16px;
    padding: 24px;
    width: 320px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-icon {
    margin-bottom: 16px;
}

.modal-box h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-box p {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.4;
}

/* Loader Overlay - Simple transparent gray background */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35); /* Gray semi-transparent */
    display: flex;
    flex-direction: column; /* Empilha GIF + texto verticalmente */
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
}

.loader-text {
    margin-top: 16px;
    color: white;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loader-overlay.hidden {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end; /* Align right like macOS */
}

.modal-actions button {
    flex: 1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.1s;
}

.btn-secondary {
    background: #E5E5EA;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #D1D1D6;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0062C3;
}

/* === Toast Notifications === */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 14px;
    background: var(--card-bg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.06);
    min-width: 320px;
    max-width: 420px;
    /* Entrance animation */
    opacity: 0;
    transform: translateX(100%);
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.toast-exit {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastSlideIn {
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
    to { opacity: 0; transform: translateX(100%); }
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Color variants */
.toast-success .toast-icon { background: var(--success-color); }
.toast-success .toast-title { color: var(--success-color); }

.toast-error .toast-icon { background: var(--danger-color); }
.toast-error .toast-title { color: var(--danger-color); }

.toast-warning .toast-icon { background: var(--warning-color); }
.toast-warning .toast-title { color: var(--warning-color); }

.toast-info .toast-icon { background: var(--primary-color); }
.toast-info .toast-title { color: var(--primary-color); }

