:root {
    --gold-primary: #D4AF37;
    --gold-hover: #F3E5AB;
    --gold-dark: #997A15;
    --gold-glow: rgba(212, 175, 55, 0.25);
    --bg-dark: #0A0A0A;
    --panel-bg: #141414;
    --panel-border: rgba(212, 175, 55, 0.2);
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --text-dim: #555;
    --input-bg: #1E1E1E;
    --danger: #e74c3c;
    --success: #2ecc71;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 3rem;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
    background-color: var(--panel-bg);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    color: var(--gold-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.logo span {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 1rem;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 0.8rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

@media (min-width: 900px) {
    .container {
        max-width: 1150px;
        padding: 2rem 1.5rem;
        gap: 2rem;
    }
}

/* ── Panels ──────────────────────────────────────────────── */
.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.4);
}

@media (min-width: 600px) {
    .panel {
        padding: 2rem;
    }
}

/* ── Total Hero ──────────────────────────────────────────── */
.total-hero {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(0, 0, 0, 0) 100%);
    border: 1px solid var(--gold-primary);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
    text-align: center;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
}

.total-hero-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.4rem;
}

.total-hero-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

#total-hero-finos {
    margin-top: 0.2rem;
    color: var(--gold-primary);
}

.total-hero .total-amount {
    font-size: 2.6rem;
}

@media (min-width: 480px) {
    .total-hero .total-amount {
        font-size: 3.2rem;
    }
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-title h2 {
    font-size: 0.95rem;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Forms ───────────────────────────────────────────────── */
.input-group {
    margin-bottom: 0.8rem;
    display: flex;
    flex-direction: column;
}

/* grid-2 siempre en 2 columnas */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

/* Fila unidad + cantidad con proporciones distintas */
.unit-qty-row {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
    margin-bottom: 0;
}

.unit-group {
    flex: 1.6;
    margin-bottom: 0;
}

.qty-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="number"],
input[type="tel"],
input[type="text"],
select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid #2a2a2a;
    color: var(--text-main);
    padding: 0.8rem 0.9rem;
    border-radius: 8px;
    font-size: 1.15rem;
    font-weight: 600;
    outline: none;
    transition: var(--transition);
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Oculta flechas en Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:focus,
select:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

select {
    cursor: pointer;
}

select option {
    background: #1a1a1a;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

.input-wrapper:focus-within {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

.input-wrapper input {
    border: none;
    border-radius: 0;
    flex-grow: 1;
    background: transparent;
    box-shadow: none !important;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
}

.currency-symbol {
    padding-left: 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
}

.currency-label {
    padding-left: 0;
    padding-right: 0.2rem;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-step {
    background: transparent;
    border: none;
    color: var(--gold-primary);
    font-size: 1.4rem;
    padding: 0 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-step:active {
    transform: scale(0.85);
}

.divider {
    border: 0;
    height: 1px;
    background: #222;
    margin: 1.5rem 0;
}

.hidden {
    display: none !important;
}

/* ── Tabs Modo Cálculo ───────────────────────────────────── */
.calc-mode-tabs {
    display: flex;
    background: #1a1a1a;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.calc-tab {
    flex: 1;
    padding: 0.55rem 0.8rem;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.calc-tab.active {
    background: var(--gold-primary);
    color: #0A0A0A;
    font-weight: 600;
}

.calc-tab:not(.active):hover {
    color: var(--text-main);
}

/* ── Total Amount ────────────────────────────────────────── */
.total-amount {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--gold-primary);
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.total-amount .currency {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-main);
}

.pulse {
    animation: pulseAnim 0.35s ease-in-out;
}

@keyframes pulseAnim {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.025);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-outline {
    background: transparent;
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-outline:hover {
    background: var(--gold-primary);
    color: var(--bg-dark);
}

.btn-primary {
    flex: 1;
    background-color: var(--gold-primary);
    color: var(--bg-dark);
    border: none;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--gold-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    flex: 1;
    background: transparent;
    border: 1px solid #333;
    color: var(--text-muted);
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    color: var(--text-main);
    background: #1e1e1e;
}

.btn-ghost-sm {
    background: transparent;
    border: 1px solid #2a2a2a;
    color: var(--text-muted);
    padding: 0.3rem 0.65rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-ghost-sm:hover {
    border-color: #444;
    color: var(--text-main);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem;
    transition: var(--transition);
    line-height: 1;
}

.btn-icon:hover {
    color: var(--text-main);
}

.btn-danger-sm {
    background: transparent;
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: rgba(231, 76, 60, 0.7);
    padding: 0.5rem 1rem;
    width: 100%;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    margin-top: 1rem;
}

.btn-danger-sm:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(231, 76, 60, 0.05);
}

/* ── Historial Panel ─────────────────────────────────────── */
.history-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100vh;
    background: var(--panel-bg);
    border-left: 1px solid var(--panel-border);
    z-index: 200;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.history-panel.open {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #222;
}

.history-header h3 {
    font-size: 1rem;
    color: var(--gold-primary);
}

.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.history-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.history-item {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
    transition: var(--transition);
}

.history-item:hover {
    border-color: rgba(212, 175, 55, 0.3);
}

.history-item .hi-date {
    color: var(--text-dim);
    font-size: 0.72rem;
    margin-bottom: 0.3rem;
}

.history-item .hi-amount {
    color: var(--gold-primary);
    font-size: 1rem;
    font-weight: 600;
}

.history-item .hi-detail {
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.history-empty {
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 0;
}

/* ── Modal Cotización ────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-box {
    transform: translateY(0);
}

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

.modal-header h3 {
    color: var(--gold-primary);
    font-size: 1rem;
}

.quote-ticket {
    background: #111;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 2;
    border: 1px dashed #333;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    border-bottom: 1px solid #1a1a1a;
    padding: 0.25rem 0;
    gap: 0.5rem;
    transition: opacity 0.2s ease;
}

.quote-check {
    accent-color: var(--gold-primary);
    flex-shrink: 0;
}

@media print {

    .exclude-print,
    .modal-actions,
    .modal-header,
    .quote-check {
        display: none !important;
    }
}

.ticket-row.total {
    color: var(--gold-primary);
    font-size: 1.05rem;
    font-weight: 700;
    border-bottom: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #333;
}

.ticket-row span:last-child {
    color: var(--text-main);
    font-weight: 500;
}

.ticket-row.total span:last-child {
    color: var(--gold-primary);
}

.modal-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

/* ── Toast ───────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #222;
    border: 1px solid var(--gold-primary);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.88rem;
    z-index: 999;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .header {
        padding: 0.8rem 1rem;
    }

    .logo span {
        display: none;
    }

    .total-amount {
        font-size: 2rem;
    }
}

/* ── Footer de versión ───────────────────────────────────── */
.app-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-dim);
    padding: 1.5rem 0 0.5rem;
    letter-spacing: 0.5px;
}