@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/inter-var.woff2') format('woff2');
}

* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

input,
select,
textarea {
    max-width: 100%;
}

button {
    touch-action: manipulation;
}

/* Toasts: estilos globales para garantizar el overlay fijo en cualquier navegador */
.toast-host {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    animation: toast-life 3.1s ease forwards;
}

.toast--exito {
    background: #dff7e7;
    color: #005236;
    border: 1px solid #6ffbbe;
}

.toast--error {
    background: #ffdad6;
    color: #93000a;
    border: 1px solid #ba1a1a;
}

.toast--info {
    background: #e8f0fe;
    color: #1a4d8f;
    border: 1px solid #a8c8fa;
}

@keyframes toast-life {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    8% {
        opacity: 1;
        transform: translateY(0);
    }
    75% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Modales de Stock: estilos globales para garantizar el overlay fijo en cualquier navegador */
.sk-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: rgba(24, 16, 6, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sk-modal {
    background: #fffdf8;
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 64px rgba(24, 16, 6, 0.28);
    position: relative;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.sk-modal h3 {
    margin: 0 0 6px;
    font-size: 19px;
    line-height: 26px;
    color: #151c27;
}

.sk-modal-sub {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 18px;
    color: #534434;
}

.sk-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #534434;
    font-size: 18px;
    cursor: pointer;
    border-radius: 9999px;
}

.sk-modal-close:hover {
    background: #f0f3ff;
}

.sk-modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sk-modal-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sk-modal-row .sk-input {
    flex: 1;
    min-width: 140px;
}

.sk-input {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #d8c3ad;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fffdf8;
    color: #151c27;
}

.sk-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px #f59e0b;
}

.sk-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.sk-modal-btn {
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
}

.sk-modal-cancel {
    background: transparent;
    border-color: #d8c3ad;
    color: #534434;
}

.sk-modal-cancel:hover {
    background: #f7efe3;
}

.sk-modal-ok {
    background: #ffb703;
    color: #613b00;
    border-color: #f59e0b;
}

.sk-modal-ok:hover {
    background: #f59e0b;
}

.sk-modal-ok:disabled {
    opacity: 0.6;
    cursor: default;
}

.sk-modal-pdf {
    max-width: 860px;
}

.sk-pdf-view {
    width: 100%;
    height: 62vh;
    border: 1px solid #d8c3ad;
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 520px) {
    .sk-modal {
        max-width: calc(100vw - 32px);
        padding: 18px;
    }

    .sk-modal-row {
        flex-direction: column;
    }

    .sk-modal-actions .sk-modal-btn {
        flex: 1;
    }
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(13.5px, 0.7vw + 12px, 15px);
    color: #1f2937;
    background: #f5f6f8;
}

h2 {
    margin: 0 0 1rem;
    font-size: clamp(1.15rem, 0.6vw + 1rem, 1.4rem);
    text-wrap: balance;
}

h3 {
    margin: 1.25rem 0 0.75rem;
    font-size: clamp(0.95rem, 0.3vw + 0.9rem, 1.05rem);
    text-wrap: balance;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f59e0b;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.topbar-title {
    font-weight: 600;
}

.content {
    padding: 1.25rem;
    overflow-wrap: anywhere;
}

.nav {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 4px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #534434;
    text-decoration: none;
    font-size: 14px;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav a:hover {
    background: #ffddb8;
    color: #653e00;
}

.nav a.active {
    background: #f59e0b;
    color: #613b00;
    font-weight: 500;
}

.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.table th, .table td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #eef0f3;
}

.table th {
    background: #f9fafb;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #6b7280;
}

.table .right {
    text-align: right;
}

.input {
    padding: 0.5rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    min-width: 0;
}

label {
    display: block;
    margin: 0.75rem 0 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: #f3f4f6;
}

.btn-primary {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #111827;
    font-weight: 600;
}

.btn-primary:hover {
    background: #d97706;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
}

.btn-ghost:hover {
    background: #f3f4f6;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.kpi-label {
    font-size: 0.8rem;
    color: #6b7280;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #e5e7eb;
    color: #374151;
}

.badge-abierto, .badge-abierta {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-cerrado, .badge-cerrada, .badge-entregado {
    background: #dcfce7;
    color: #15803d;
}

.badge-cancelado {
    background: #fee2e2;
    color: #b91c1c;
}

.form-row {
    margin-bottom: 0.75rem;
}

.form-inline {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.6rem;
}

.alert-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.75rem;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-title {
    margin: 0;
    font-size: 1.6rem;
}

.login-subtitle {
    color: #6b7280;
    margin: 0.25rem 0 1rem;
}

.saldo {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Breakpoints escalonados: 1280 / 1024 / 900 / 768 / 640 / 520 px
   - 900px: drawer del sidebar (ver MainLayout.razor.css)
   - 640px: tablas -> tarjetas apiladas en las páginas
   - 520px: toolbars/filtros a una columna */

.x-scroll {
    overflow-x: auto;
    min-width: 0;
}

@media (max-width: 1024px) {
    .content {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 0.6rem;
    }

    .kpi-value {
        font-size: 1.35rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 0.6rem;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .input,
    .form-inline .btn {
        width: 100%;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
        justify-content: center;
    }

    .input {
        font-size: 16px;
    }
}
