@font-face {
    font-family: 'MontserratWeb';
    src: url('/assets/fonts/montserrat-400.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'MontserratWeb';
    src: url('/assets/fonts/montserrat-500.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'MontserratWeb';
    src: url('/assets/fonts/montserrat-600.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'MontserratWeb';
    src: url('/assets/fonts/montserrat-700.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand-black: #000000;
    --brand-orange: #f07518;
    --brand-gray: #adadad;
    --surface: #ffffff;
    --surface-soft: #f6f6f6;
    --line: #dbdbdb;
    --text: #111111;
    --text-muted: #5f5f5f;
    --danger-bg: #fff1f1;
    --danger-line: #f2c2c2;
    --danger-text: #8a1f1f;
    --radius-sm: 6px;
    --radius-md: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Century Gothic", "MontserratWeb", "Trebuchet MS", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(240, 117, 24, 0.08) 0%, rgba(255, 255, 255, 0) 220px),
        var(--surface-soft);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

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

.card + .card {
    margin-top: 16px;
}

.card-title {
    margin: 0 0 6px 0;
    font-weight: 700;
}

.brand-mark {
    width: 140px;
    height: auto;
    display: block;
}

.btn {
    border: 1px solid var(--brand-orange);
    background: var(--brand-orange);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    font-weight: 600;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:hover {
    filter: brightness(0.95);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #fff;
    color: var(--brand-orange);
}

.error {
    border: 1px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-text);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 16px;
}

.notice {
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
    border: 1px solid;
}

.notice-ok {
    border-color: #b8e0c4;
    background: #ecfff1;
    color: #15682d;
}

.notice-error {
    border-color: var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.input {
    width: 100%;
    border: 1px solid #cfcfcf;
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-top: 6px;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(240, 117, 24, 0.15);
}

.field {
    margin-bottom: 14px;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.muted {
    color: var(--text-muted);
}

.login-card {
    max-width: 430px;
    width: min(430px, calc(100vw - 28px));
    margin: 0;
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-color: rgba(240, 117, 24, 0.22);
}

.login-shell {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
    position: relative;
    z-index: 2;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.login-title {
    margin: 0;
    font-weight: 700;
}

.login-three-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: #f7f7f7;
}

.login-three-bg canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.dashboard-title {
    margin: 0;
    font-weight: 700;
}

.dashboard-subtitle {
    margin: 8px 0 0 0;
}

.session-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.session-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eeeeee;
}

.session-list li:last-child {
    border-bottom: 0;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-dark {
    background: var(--brand-black);
    border-color: var(--brand-black);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.table th,
.table td {
    border-bottom: 1px solid #ececec;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.table th {
    background: #fafafa;
    color: #333;
    font-weight: 700;
}

.pill {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    padding: 2px 8px;
    background: #fff;
}

.pill-low {
    color: #8a1f1f;
    border-color: #f0b4b4;
    background: #fff4f4;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

.search-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.quick-filter {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.quick-filter:hover,
.quick-filter-active {
    border-color: var(--brand-orange);
    background: #fff4ea;
    color: var(--brand-orange);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pager-links {
    display: flex;
    gap: 8px;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    z-index: 10;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    max-height: 220px;
    overflow-y: auto;
}

.items-table-wrap {
    overflow: visible;
    position: relative;
    z-index: 20;
}

.items-table {
    min-width: 0;
    table-layout: fixed;
}

.items-table-wrap .autocomplete-list {
    max-height: 320px;
    z-index: 30;
}

.items-table td {
    overflow: visible;
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}

.autocomplete-item:last-child {
    border-bottom: 0;
}

.autocomplete-item:hover {
    background: #fff8f2;
}

.split {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 16px;
}

.module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px;
    background: var(--surface-soft);
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.module-tile:hover {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.toast-host {
    position: fixed;
    top: 12.5%;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    z-index: 2200;
    width: min(520px, calc(100vw - 24px));
}

.toast {
    border: 1px solid;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    background: #fff;
    opacity: 1;
    transition: opacity 0.18s ease;
}

.toast-ok {
    border-color: #b8e0c4;
    background: #ecfff1;
    color: #15682d;
}

.toast-error {
    border-color: var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-text);
}

.toast-hide {
    opacity: 0;
}

.orders-toolbar {
    padding: 0 4px;
}

.orders-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.order-card {
    border-top: 6px solid var(--brand-orange);
}

.order-card-missing-picker {
    border-top-color: #c02f2f;
}

.order-card-has-picker {
    border-top-color: #1f8f45;
}

.order-card-new {
    border-top-color: var(--brand-orange);
    box-shadow: 0 0 0 2px rgba(240, 117, 24, 0.12), var(--shadow-sm);
}

.order-card-head {
    align-items: flex-start;
}

.order-summary p {
    margin: 8px 0;
}

.order-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.order-actions-grid form {
    display: grid;
    gap: 8px;
    align-content: start;
}

.order-status-en-proceso {
    border-color: #d6d6d6;
    background: #f7f7f7;
}

.order-status-nuevo {
    color: #9a4700;
    border-color: #f2bf8f;
    background: #fff2e5;
}

.order-status-a-la-espera-de-guia {
    color: #725000;
    border-color: #ead58c;
    background: #fff8d8;
}

.order-status-listo {
    color: #15682d;
    border-color: #b8e0c4;
    background: #ecfff1;
}

.order-status-enviado {
    color: #174a7a;
    border-color: #b7d4ef;
    background: #edf7ff;
}

.pill-alert {
    border-color: var(--brand-orange);
    background: #fff2e5;
    color: #9a4700;
    font-weight: 700;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.46);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(980px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    padding: 20px;
}

.order-detail-content {
    margin: 14px 0;
}

@media (max-width: 640px) {
    .container {
        padding: 14px;
    }

    .brand-mark {
        width: 110px;
    }

    .grid-2,
    .grid-3,
    .split {
        grid-template-columns: 1fr;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .orders-grid,
    .order-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 1100px) {
    .orders-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
