:root {
    --primary: #FFB300;
    --primary-light: #FFC107;
    --primary-dark: #cc9000;
    --accent: #002B5B;
    --text: #1a1a1a;
    --text-light: #666666;
    --white: #ffffff;
    --bg: #ffffff;
    --bg-alt: #fcfcfc;
    --border: #eeeeee;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --container: 1600px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background-color: var(--bg-alt);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header & Branding */
header {
    background: #fff;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border);
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.vertical-sep {
    width: 2px;
    height: 40px;
    background: var(--border);
}

.brand-text h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text);
    line-height: 1;
}

.brand-text p {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Hanging Badge */
.municipality-badge {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--white);
    padding: 12px 60px;
    border-radius: 0 0 16px 16px;
    font-weight: 800;
    letter-spacing: 5px;
    font-size: 1.05rem;
    box-shadow: 0 4px 10px rgba(255, 179, 0, 0.3);
    white-space: nowrap;
    z-index: 10;
    transition: var(--transition);
    cursor: default;
}

.municipality-badge:hover {
    background: var(--primary-dark);
    box-shadow: 0 8px 25px rgba(255, 179, 0, 0.8), 0 0 15px rgba(255, 179, 0, 0.5);
    transform: translateX(-50%) translateY(4px);
}

/* Hero Section */
.hero {
    padding: 8rem 2rem 3rem;
    text-align: center;
    background: #fff;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: #333;
    line-height: 1.25;
    margin-bottom: 2rem;
    letter-spacing: -0.5px;
}

.highlight-midr {
    color: #D4AF37;
    /* Adjusted to a more golden orange if needed, but keeping primary dark for now */
    color: var(--primary-dark);
    font-weight: 800;
}

.ministerio-box {
    margin-bottom: 2.5rem;
}

.highlight-ministerio {
    display: inline-block;
    background: var(--primary);
    color: #000;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 179, 0, 0.3);
    border: 2px solid var(--primary-dark);
    max-width: 100%;
}

.hero-subtitle {
    font-size: 1rem;
    color: #777;
    margin: 0 auto 3rem;
    max-width: 900px;
    line-height: 1.6;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    padding: 1rem 2rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.search-box:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 8px 25px rgba(255, 179, 0, 0.15);
    transform: translateY(-2px);
}

.search-icon {
    color: var(--primary-dark);
    margin-right: 15px;
    width: 24px;
    height: 24px;
}

#equipment-search {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 1.1rem;
    outline: none;
    color: var(--text);
    font-weight: 500;
}

/* Grid & Cards */
.container {
    max-width: var(--container);
    margin: 2rem auto;
    padding: 0 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 3rem 0;
}

@media (min-width: 1400px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.card-image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #fcfcfc;
    margin-bottom: 1rem;
}

.item-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary);
    color: #000;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    z-index: 2;
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    padding: 0.5rem;
    transition: var(--transition);
}

.card:hover .card-image {
    transform: scale(1.05);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #444;
    line-height: 1.3;
    margin-bottom: 1.5rem;
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.btn-item-link {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #000;
    text-decoration: none;
    padding: 0.9rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-item-link:hover {
    background: var(--primary-dark);
}

/* CTA Section (Bottom Button) */
.cta-section {
    text-align: center;
    margin: 4rem 0 6rem;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #000;
    text-decoration: none;
    padding: 0.9rem 1.5rem; /* a bit wider since text is long, matching original design's spirit, but shorter height */
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: 0 10px 25px rgba(255, 179, 0, 0.2);
}

.btn-cta:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Footer */
footer {
    background: #fff;
    padding: 3rem 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

footer p {
    color: #444;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.footer-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.footer-logo-img {
    height: 50px;
    opacity: 0.8;
}

.footer-wa-circle {
    position: relative;
    width: 60px;
    height: 60px;
}

.wa-photo-badge {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #FFD700;
    padding: 2px;
    background: #fff;
}

.wa-icon-mini {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #25D366;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.wa-icon-mini svg {
    fill: #fff;
}

/* Floating Nav */
#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary);
    color: #000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 179, 0, 0.3);
    border: 2px solid var(--primary-dark);
    z-index: 1000;
    transition: var(--transition);
}

#scroll-to-top:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 179, 0, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        justify-content: center;
    }

    .brand-wrapper {
        flex-direction: column;
        justify-content: center;
        gap: 0.3rem;
    }

    .vertical-sep {
        display: none;
    }

    .brand-text {
        text-align: center;
    }

    .brand-text p {
        display: block;
        font-size: 0.7rem;
        margin-top: 0;
        max-width: 300px;
        line-height: 1.2;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .highlight-ministerio {
        font-size: 1.1rem;
        padding: 0.8rem 1rem;
        white-space: normal;
        line-height: 1.4;
        border-radius: 20px;
        width: 100%;
        text-align: center;
    }

    .hero {
        padding: 6rem 1rem 3rem;
    }

    .municipality-badge {
        padding: 8px 15px;
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .card {
        border: 2px solid var(--primary-dark);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        margin-bottom: 2rem;
    }

    .btn-cta {
        font-size: 0.9rem;
        padding: 1rem 1.2rem;
        white-space: nowrap;
        width: 100%;
        justify-content: center;
    }

    footer {
        padding: 2rem 1rem;
    }

    footer p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
        white-space: nowrap;
    }

    .footer-logo-img {
        height: 40px;
    }

    .footer-wa-circle {
        width: 50px;
        height: 50px;
    }

    .footer-row {
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    header {
        justify-content: center;
        padding: 1rem 15px !important;
    }
}

/* --- WIDGET & MODAL CSS --- */
:root {
  --modal-bg: #0f172a;
  --modal-card: #ffffff;
  --modal-text: #0f172a;
  --modal-muted: #475569;
  --modal-line: #e2e8f0;
  --modal-accent: #2563eb;
  --modal-accent-2: #1d4ed8;
  --modal-soft: #f8fafc;
}

.widget-card {
  max-width: 860px;
  margin: 30px auto;
  background: var(--modal-card);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  padding: 28px;
  border: 1px solid var(--modal-line);
  text-align: left;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  font-weight: 700;
  margin-bottom: 10px;
}

.widget-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.2;
}

.widget-card p {
  margin: 0 0 18px;
  color: var(--modal-muted);
  line-height: 1.55;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn-primary-widget {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
  background: var(--primary);
  color: #000;
}

.btn-primary-widget:hover { 
  transform: translateY(-1px);
  background: var(--primary-dark);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 24px;
  z-index: 9999;
}

.modal.active { display: flex; }

.modal-panel {
  width: min(1200px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  padding: 24px;
  position: relative;
  text-align: left;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 12px;
  z-index: 5;
}

.modal-title h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.modal-title p {
  margin: 0;
  font-size: 14px;
  color: var(--modal-muted);
}

.close-btn {
  background: #e2e8f0;
  color: #0f172a;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.close-btn:hover {
  background: #cbd5e1;
}

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.print-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

@media print {
  body > *:not(#resumoModal) {
    display: none !important;
  }
  #resumoModal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .modal-panel {
    box-shadow: none !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .close-btn, .print-btn, .modal-header-actions {
    display: none !important;
  }
  .category {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .summary-boxes, .footer-total, .category-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.summary-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.summary-box {
  background: var(--modal-soft);
  border: 1px solid var(--modal-line);
  border-radius: 16px;
  padding: 16px;
}

.summary-box .label {
  font-size: 12px;
  color: var(--modal-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.summary-box .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--modal-text);
}

.category {
  margin-top: 26px;
  border: 1px solid var(--modal-line);
  border-radius: 18px;
  overflow: hidden;
}

.category-header {
  padding: 16px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--modal-line);
}

.category-header h3 {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--modal-text);
}

.category-header .subtotal {
  color: var(--modal-muted);
  font-size: 14px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.modal-panel table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: #fff;
}

.modal-panel th, .modal-panel td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--modal-line);
  vertical-align: top;
  font-size: 14px;
  color: var(--modal-text);
}

.modal-panel th {
  background: #f8fafc;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--modal-muted);
  letter-spacing: 0.03em;
}

.modal-panel tr:hover td { background: #f8fbff; }

.item-col { width: 70px; }
.num-col { width: 150px; }
.value-col { width: 170px; white-space: nowrap; font-weight: 700; }

.footer-total {
  margin-top: 28px;
  padding: 18px;
  border-radius: 18px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #1e3a8a;
}

.footer-total strong {
  font-size: 18px;
}

@media (max-width: 640px) {
  .widget-card, .modal-panel { padding: 18px; }
  .widget-card h1 { font-size: 24px; }
  .modal-title h2 { font-size: 20px; }
}