*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --blue-primary: #03366D;
    --blue-dark: #022550;
    --blue-light: #0a4a8a;
    --red-primary: #a6192e;
    --red-dark: #8b1526;
    --red-light: #c4253a;
    --dark-text: #1F2937;
    --medium-text: #4B5563;
    --light-text: #6B7280;
    --bg-light: #F9FAFB;
    --bg-white: #FFFFFF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    --footer-dark: #0A192F;
    --yellow-input: #FFF9E6;
    --yellow-border: #F5D04E;
    --yellow-focus: #EAB308;
    --green-success: #10B981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--dark-text);
    background: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

/* Header */
.header {
    background: var(--blue-primary);
    color: white;
    padding: 0 32px;
    height: 72px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--red-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 12px;
    opacity: 0.75;
    font-weight: 400;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    opacity: 0.85;
}

.nav-link:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

.btn-admin {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-admin:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

/* Main */
.main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 32px;
}

/* Section Header */
.section-header {
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 8px;
}

.section-header p {
    color: var(--light-text);
    font-size: 15px;
    line-height: 1.5;
}

/* Calculator Table */
.calculator-table-wrapper {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    border: 1px solid var(--border);
}

.calculator-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.calculator-table thead {
    background: var(--blue-primary);
    color: white;
}

.calculator-table th {
    padding: 14px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
}

.calculator-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.calculator-table tbody tr {
    transition: var(--transition);
}

.calculator-table tbody tr:hover {
    background: #f8fafc;
}

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

.col-item { width: 36px; }
.col-product { min-width: 160px; }
.col-solids { width: 75px; }
.col-mils { width: 65px; }
.col-rend-t { width: 90px; }
.col-merma { width: 70px; }
.col-rend-perc { width: 75px; }
.col-rend-p { width: 95px; }
.col-m2 { width: 90px; }
.col-gallons { width: 95px; }

/* Input fields */
.input-yellow {
    background: var(--yellow-input);
    border: 2px solid var(--yellow-border);
    border-radius: 6px;
    padding: 7px 6px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    text-align: center;
    width: 100%;
    transition: var(--transition);
    color: var(--dark-text);
}

.input-yellow:focus {
    outline: none;
    border-color: var(--yellow-focus);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2);
}

select.input-yellow {
    cursor: pointer;
    text-align: left;
    padding-right: 28px;
    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='%236B7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.cell-computed {
    font-weight: 600;
    color: var(--blue-primary);
    font-size: 13px;
}

.cell-result {
    background: var(--blue-primary);
    color: white;
    font-weight: 700;
    font-size: 16px;
    font-family: 'Outfit', sans-serif;
    border-radius: 6px;
    padding: 6px 10px;
    display: inline-block;
    min-width: 50px;
}

.cell-item {
    font-weight: 600;
    color: var(--light-text);
    font-size: 14px;
}

.btn-remove-row {
    background: none;
    border: none;
    color: var(--light-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-row:hover {
    color: var(--red-primary);
    background: #FEE2E2;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--red-primary);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-primary:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    color: var(--dark-text);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: #D1D5DB;
    transform: translateY(-1px);
}

.btn-danger {
    color: var(--red-primary);
    border-color: #FECACA;
}

.btn-danger:hover {
    background: #FEF2F2;
    border-color: var(--red-primary);
}

/* Notes */
.notes {
    margin-top: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--yellow-focus);
}

.notes p {
    font-size: 12px;
    color: var(--light-text);
    line-height: 1.8;
}

/* Summary Section */
.summary-section {
    margin-top: 32px;
}

.summary-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 16px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.summary-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.summary-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--blue-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.summary-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.summary-card-label {
    color: var(--light-text);
}

.summary-card-value {
    font-weight: 600;
    color: var(--dark-text);
}

.summary-card-result {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--blue-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-card-result .summary-card-label {
    font-weight: 600;
    color: var(--blue-primary);
    font-size: 14px;
}

.summary-card-result .summary-card-value {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--red-primary);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s ease;
}

.modal-small {
    max-width: 480px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--blue-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--light-text);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--dark-text);
}

.modal-body {
    padding: 24px;
}

/* Constant Admin */
.constant-admin {
    margin-bottom: 0;
}

.constant-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.constant-admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.constant-admin-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--medium-text);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.constant-admin-value {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--blue-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.admin-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Warning modal */
.modal-header-warning {
    background: #FEF3C7;
    border-bottom-color: #F59E0B;
}

.modal-header-warning h2 {
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header-warning h2 svg {
    stroke: #D97706;
    flex-shrink: 0;
}

.warning-message {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.warning-message p {
    font-size: 13px;
    color: #78350F;
    line-height: 1.6;
    margin-bottom: 6px;
}

.warning-message p:last-child {
    margin-bottom: 0;
}

.btn-warning {
    background: #D97706;
}

.btn-warning:hover {
    background: #B45309;
}

/* Admin */
.admin-actions {
    margin-bottom: 16px;
}

.admin-table-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 500px;
    overflow-y: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table thead {
    background: var(--bg-light);
    position: sticky;
    top: 0;
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--light-text);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.admin-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.admin-btn-edit {
    color: var(--blue-primary);
}

.admin-btn-edit:hover {
    background: #EFF6FF;
}

.admin-btn-delete {
    color: var(--red-primary);
}

.admin-btn-delete:hover {
    background: #FEF2F2;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    color: var(--dark-text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(3, 54, 109, 0.1);
}

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

/* Footer */
.footer {
    background: var(--footer-dark);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 24px 32px;
    font-size: 13px;
    margin-top: auto;
}

.footer-contact {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 991px) {
    .main {
        padding: 20px 16px;
    }

    .header {
        padding: 0 16px;
    }

    .calculator-table-wrapper {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

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

    .section-header h1 {
        font-size: 22px;
    }

    .calculator-table {
        font-size: 12px;
    }

    .calculator-table th {
        font-size: 10px;
        padding: 10px 6px;
    }

    .calculator-table td {
        padding: 8px 4px;
    }

    .input-yellow {
        padding: 6px 4px;
        font-size: 12px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .modal {
        margin: 20px;
    }

    .constant-bar {
        flex-wrap: wrap;
        font-size: 13px;
    }
}
