:root {
    --primary: #0066cc;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #333;
    --border: #e1e4e8;
    --success: #28a745;
    --error: #dc3545;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding-top: 80px;
}

.search-container {
    width: 100%;
    max-width: 700px;
    padding: 0 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 32px;
    margin: 0 0 10px 0;
    color: var(--primary);
}

.search-box {
    display: flex;
    gap: 10px;
    background: var(--surface);
    padding: 10px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
}

input {
    flex: 1;
    border: none;
    font-size: 18px;
    padding: 10px 20px;
    outline: none;
    border-radius: 40px;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

button:hover {
    background-color: #0056b3;
    transform: scale(1.02);
}

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

.status-msg {
    text-align: center;
    margin-top: 15px;
    min-height: 20px;
    font-size: 14px;
}

.error {
    color: var(--error);
}

.success {
    color: var(--success);
}

/* Result Card */
.result-container {
    margin-top: 40px;
    background: transparent;
    border-radius: 12px;
    padding: 0;
    box-shadow: none;
    border: none;
    animation: fadeIn 0.3s ease-out;
    width: 100%;
}

.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.header-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.result-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1a1a1a;
}

.badge {
    background: #e3f2fd;
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.section-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.section-card h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.field-group {
    margin-bottom: 12px;
}

.field-group label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.field-group div {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.section-card.full {
    grid-column: 1 / -1;
}

.row-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.row-group.three-col>div {
    flex: 1;
    min-width: 120px;
}

.cnae-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.cnae-item {
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cnae-item.highlight {
    font-weight: 600;
    color: var(--primary);
}

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

.field {
    display: flex;
    flex-direction: column;
}

.field.full {
    grid-column: span 2;
}

.field label {
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field div {
    font-size: 16px;
    font-weight: 500;
}

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

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

/* ICMS/Price Table Container */
.icms-container {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fc;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
}

.icms-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}

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

/* Modal Rules */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.close-btn:hover {
    color: #333;
    background: none;
    transform: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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