:root {
  --coffee: #39271f;
  --coffee-2: #51392d;
  --cocoa: #79533d;
  --caramel: #c38b55;
  --cream: #f7f3ed;
  --paper: #fffdfa;
  --ink: #2e2925;
  --muted: #8b8178;
  --line: #ebe4dc;
  --green: #397b5b;
  --red: #b84f42;
  --shadow: 0 12px 34px rgba(53, 38, 29, .07);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; color: var(--ink); font-family: 'DM Sans', sans-serif; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--caramel); font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; color: #fff8ef; background: linear-gradient(145deg, #9c6b44, #4b3024); font: 800 29px 'Manrope', sans-serif; box-shadow: 0 8px 18px rgba(57,39,31,.18); }
.brand-mark.small { width: 41px; height: 41px; border-radius: 13px; font-size: 22px; }
.brand-logo { display: block; object-fit: contain; }
.login-logo { width: 104px; height: 104px; margin: 0 auto 18px; }
.nexoflow-title { margin: 0; text-align: center; font: 800 34px 'Manrope', sans-serif; letter-spacing: -.055em; color: var(--coffee); }
.brand-tagline { margin: 5px 0 20px; text-align: center; color: var(--cocoa); font-size: 13px; font-weight: 600; }
.sidebar-logo { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 10px; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #e9d8c5 0, transparent 28%), radial-gradient(circle at 85% 85%, #e5d7c8 0, transparent 25%), var(--cream); }
.login-card { width: min(100%, 410px); padding: 42px; border: 1px solid rgba(121,83,61,.12); border-radius: 26px; background: var(--paper); box-shadow: 0 22px 70px rgba(57,39,31,.12); }
.login-card .brand-mark { margin-bottom: 28px; }
.login-card h1 { margin: 0; font: 800 34px 'Manrope', sans-serif; letter-spacing: -.06em; color: var(--coffee); }
.login-card h1 span { color: var(--caramel); }
.login-subtitle { margin: 9px 0 28px; font-size: 14px; }
.form-stack { display: flex; flex-direction: column; gap: 9px; }
label { font-size: 12px; font-weight: 700; color: #574b42; }
input, select, textarea { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; color: var(--ink); background: #fff; transition: border .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(195,139,85,.13); }
.form-stack input { margin-bottom: 8px; }
.form-error { min-height: 15px; margin: 0; color: var(--red); font-size: 12px; }
.login-foot { margin: 26px 0 0; text-align: center; font-size: 11px; color: #a49a91; }
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 13px; transition: transform .15s, opacity .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: white; background: var(--coffee); }
.btn-primary:hover { background: var(--coffee-2); }
.btn-secondary { color: var(--coffee); background: #efe6dc; }
.btn-outline { color: var(--coffee); background: transparent; border: 1px solid var(--line); }
.btn-danger { color: var(--red); background: #faeae7; }
.btn-full { width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: 5px; padding: 14px 16px; }
.btn-sm { padding: 8px 11px; font-size: 11px; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; width: 245px; display: flex; flex-direction: column; padding: 27px 17px 18px; background: var(--coffee); color: #fff; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 36px; color: white; text-decoration: none; }
.side-brand strong { display: block; font: 800 19px 'Manrope', sans-serif; letter-spacing: -.04em; }
.side-brand span { display: block; margin-top: 2px; color: #c8a98d; font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.side-label { padding: 0 12px 12px; color: #a9907e; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.side-nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; border: 0; border-radius: 10px; color: #d7c9bd; text-align: left; font-size: 13px; background: transparent; }
.nav-link:hover { background: rgba(255,255,255,.07); color: white; }
.nav-link.active { color: #fff; background: #634734; box-shadow: inset 3px 0 var(--caramel); }
.nav-icon { width: 18px; text-align: center; font-size: 18px; color: #d0a77f; }
.nav-count { margin-left: auto; padding: 2px 7px; border-radius: 20px; color: #f4dfc8; background: rgba(255,255,255,.12); font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.profile-chip { display: flex; align-items: center; gap: 10px; padding: 14px 8px; border-top: 1px solid rgba(255,255,255,.12); }
.avatar, .top-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: #986b48; font-weight: 800; }
.profile-chip strong { display: block; font-size: 12px; }
.profile-chip span { display: block; margin-top: 3px; color: #bda99a; font-size: 10px; }
.logout-btn { width: 100%; padding: 10px; border: 0; border-radius: 8px; color: #d7c9bd; text-align: left; background: transparent; font-size: 12px; }
.logout-btn:hover { color: white; background: rgba(255,255,255,.07); }
.main-content { width: calc(100% - 245px); min-height: 100vh; margin-left: 245px; padding: 0 38px 20px; }
.topbar { min-height: 105px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font: 800 25px 'Manrope', sans-serif; letter-spacing: -.04em; color: var(--coffee); }
.topbar-right { display: flex; align-items: center; gap: 13px; }
.today-label { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.top-avatar { width: 37px; height: 37px; color: var(--coffee); background: #e8d7c4; }
.page-content { max-width: 1400px; margin: 0 auto; padding: 28px 0 35px; }
.app-footer { padding: 15px 0; border-top: 1px solid var(--line); color: #a59a90; font-size: 10px; }
.app-footer span { padding: 0 5px; color: var(--caramel); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-heading h3 { margin: 0; color: var(--coffee); font: 800 20px 'Manrope', sans-serif; letter-spacing: -.04em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); }
.stat-card { padding: 17px 18px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.stat-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--cocoa); background: #f1e7dc; font-size: 16px; }
.stat-value { margin-top: 13px; color: var(--coffee); font: 800 23px 'Manrope', sans-serif; letter-spacing: -.04em; }
.stat-note { margin-top: 5px; color: #9c9187; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(260px,.9fr); gap: 16px; }
.panel { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.panel-head h4 { margin: 0; color: var(--coffee); font: 700 14px 'Manrope', sans-serif; }
.panel-head span { color: var(--muted); font-size: 10px; }
.quick-actions { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; }
.quick-action { display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--coffee); text-align: left; background: #fff; font-size: 12px; font-weight: 700; }
.quick-action:hover { border-color: #d6b995; background: #fcf8f2; }
.quick-action b { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--cocoa); background: #f1e7dc; font-size: 17px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 10px 9px; border-bottom: 1px solid var(--line); color: #9a8e83; text-align: left; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 12px 9px; border-bottom: 1px solid #f1ece6; color: #51483f; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
.text-right { text-align: right; }
.empty-state { padding: 28px 15px; color: #a59a90; text-align: center; font-size: 12px; }
.status-pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 30px; color: var(--green); background: #eaf3ed; font-size: 9px; font-weight: 700; }
.status-pill.draft { color: #9b6a29; background: #f7efdf; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field small { color: #9c9187; font-size: 10px; }
.sale-layout { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(270px,.8fr); gap: 16px; align-items: start; }
.section-title { margin: 0 0 14px; color: var(--coffee); font: 700 13px 'Manrope', sans-serif; }
.customer-fields { margin-bottom: 18px; }
.add-line { display: grid; grid-template-columns: minmax(0,1fr) 80px 105px auto; align-items: end; gap: 9px; margin-bottom: 12px; }
.line-item { display: grid; grid-template-columns: minmax(0,1fr) 52px 80px 80px 85px 30px; gap: 7px; align-items: center; padding: 10px 0; border-bottom: 1px solid #f1ece6; font-size: 11px; }
.line-item.header { color: #9a8e83; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.line-item .line-name { min-width: 0; white-space: normal; }
.line-item input { min-height: 32px; padding: 5px 7px; font-size: 11px; }
.remove-line { border: 0; color: var(--red); background: transparent; font-size: 17px; }
.totals-box { padding: 16px; border-radius: 12px; background: #f8f3ed; }
.total-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; color: #74685e; font-size: 12px; }
.total-row.grand { margin-top: 7px; padding-top: 12px; border-top: 1px solid #e5d8c9; color: var(--coffee); font-size: 16px; font-weight: 800; }
.sale-actions { display: grid; gap: 8px; margin-top: 14px; }
.filter-row { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row .field { min-width: 150px; }
.filter-row .field label { font-size: 10px; }
.summary-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 15px; }
.summary-box { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.summary-box span { display: block; color: var(--muted); font-size: 10px; }
.summary-box strong { display: block; margin-top: 6px; color: var(--coffee); font: 800 17px 'Manrope', sans-serif; }
.action-cell { display: flex; align-items: center; gap: 5px; }
.action-cell button { padding: 5px 7px; border: 0; border-radius: 6px; color: var(--cocoa); background: #f3ece4; font-size: 10px; }
.action-cell button.delete { color: var(--red); background: #faeae7; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: calc(100vw - 44px); padding: 12px 16px; border-radius: 10px; color: white; background: var(--coffee); box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .22s; }
.toast.show { opacity: 1; transform: translateY(0); }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(35,25,19,.45); }
.modal { width: min(100%,460px); padding: 22px; border-radius: 17px; background: var(--paper); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 16px; font: 800 18px 'Manrope',sans-serif; color: var(--coffee); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.report-note { margin: 0 0 14px; color: var(--muted); font-size: 11px; }
@media (max-width: 1050px) {
  .sidebar { width: 210px; }
  .main-content { width: calc(100% - 210px); margin-left: 210px; padding: 0 25px 18px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .app-shell { display: block; padding-bottom: 68px; }
  .sidebar { inset: auto 0 0; width: 100%; height: 66px; padding: 5px 7px calc(5px + env(safe-area-inset-bottom)); flex-direction: row; align-items: center; box-shadow: 0 -5px 20px rgba(40,28,20,.12); }
  .side-brand, .side-label, .sidebar-bottom { display: none; }
  .side-nav { width: 100%; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 2px; }
  .nav-link { min-width: 0; min-height: 54px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 5px 1px; border-radius: 8px; color: #d3c4b8; text-align: center; font-size: 8px; }
  .nav-link.active { box-shadow: inset 0 2px var(--caramel); }
  .nav-icon { width: auto; font-size: 17px; line-height: 19px; }
  .nav-count { display: none; }
  .main-content { width: 100%; margin: 0; padding: 0 15px 12px; }
  .topbar { min-height: 78px; }
  .topbar h2 { font-size: 21px; }
  .topbar .eyebrow { font-size: 8px; }
  .today-label { max-width: 112px; text-align: right; font-size: 9px; }
  .top-avatar { width: 31px; height: 31px; }
  .page-content { padding: 20px 0 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 16px; }
  .page-heading h3 { font-size: 18px; }
  .stats-grid { gap: 9px; margin-bottom: 12px; }
  .stat-card { padding: 12px; border-radius: 12px; }
  .stat-top { font-size: 9px; }
  .stat-icon { width: 27px; height: 27px; }
  .stat-value { margin-top: 10px; font-size: 19px; }
  .stat-note { font-size: 9px; }
  .dashboard-grid, .sale-layout { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 14px; border-radius: 12px; }
  .quick-action { min-height: 54px; padding: 8px; font-size: 10px; }
  .form-grid { gap: 10px; }
  .field label { font-size: 11px; }
  input, select, textarea { min-height: 41px; font-size: 13px; }
  .add-line { grid-template-columns: minmax(0,1fr) 68px; }
  .add-line .field:nth-child(3) { grid-column: 1; }
  .add-line button { grid-column: 2; grid-row: 2; min-height: 41px; }
  .line-item { grid-template-columns: minmax(0,1fr) 43px 64px 26px; gap: 5px; }
  .line-item > :nth-child(3), .line-item > :nth-child(5) { display: none; }
  .line-item.header > :nth-child(3), .line-item.header > :nth-child(5) { display: none; }
  .summary-strip { gap: 7px; }
  .summary-box { padding: 10px; }
  .summary-box span { font-size: 8px; }
  .summary-box strong { font-size: 14px; }
  .filter-row { gap: 8px; }
  .filter-row .field { min-width: calc(50% - 5px); flex: 1; }
  th { font-size: 8px; }
  td { font-size: 10px; padding: 10px 7px; }
  .app-footer { padding-bottom: 8px; }
}
@media (max-width: 390px) {
  .login-card { padding: 30px 23px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nav-link { font-size: 7px; }
}
@media print {
  .sidebar, .topbar, .app-footer, .heading-actions, .toast { display: none !important; }
  .main-content { width: 100%; margin: 0; padding: 0; }
  body, html { background: white; }
  .panel, .stat-card { box-shadow: none; }
}


/* Control de producción */
.production-summary { margin-bottom: 15px; }
.production-panel { padding: 17px; }
.production-filters { align-items: end; margin-bottom: 16px; }
.production-search { flex: 1; min-width: 220px; }
.production-status-filter { width: 190px; }
.production-list-head { margin-bottom: 8px; }
.production-table td { vertical-align: middle; }
.production-items-cell { white-space: normal; min-width: 145px; line-height: 1.5; }
.status-pill.production-en_proceso { color: #98651f; background: #f8efdF; }
.status-pill.production-listo { color: #245f8c; background: #e8f1f8; }
.status-pill.production-entregado { color: #397b5b; background: #eaf3ed; }
.status-pill.production-cancelado { color: #9c3931; background: #faeae7; }
.order-modal { width: min(100%, 760px); max-height: min(90vh, 900px); overflow-y: auto; }
.order-modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-modal-heading .eyebrow { margin-bottom: 5px; }
.order-modal-heading h3 { margin-bottom: 17px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--coffee); background: #f4eee7; font-size: 23px; line-height: 1; }
.order-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfa; }
.order-facts div { min-width: 0; }
.order-facts span, .order-notes > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.order-facts strong { display: block; overflow-wrap: anywhere; color: var(--coffee); font-size: 11px; }
.order-section-title { margin-top: 18px; }
.order-items-wrap { border: 1px solid var(--line); border-radius: 10px; }
.order-items-table td { white-space: normal; }
.order-total-box { display: grid; gap: 8px; width: min(100%, 330px); margin: 14px 0 14px auto; padding: 13px 15px; border-radius: 11px; background: #f8f3ed; }
.order-total-box div { display: flex; justify-content: space-between; gap: 14px; color: #74685e; font-size: 11px; }
.order-total-box .order-grand-total { padding-top: 9px; border-top: 1px solid #e5d8c9; color: var(--coffee); font-size: 14px; font-weight: 800; }
.order-notes { margin: 12px 0 16px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }
.order-notes p { margin: 0; color: #51483f; font-size: 11px; white-space: pre-wrap; }
.order-status-control { display: flex; align-items: end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.order-status-control .field { flex: 1; }
@media (max-width: 760px) {
  .side-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .production-panel { padding: 13px; }
  .production-search, .production-status-filter { width: auto; min-width: calc(50% - 5px); flex: 1; }
  .order-modal { padding: 16px; }
  .order-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; }
  .order-status-control { align-items: stretch; flex-direction: column; }
}

/* Roles separados y flujo de pedidos / entregas */
.side-nav.production-nav { grid-template-columns: 1fr; }
.production-cards, .delivery-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.production-order-card, .delivery-order-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fffdfa; }
.production-card-top, .delivery-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.order-number { display: block; color: var(--coffee); font: 800 14px 'Manrope', sans-serif; }
.order-date { display: block; margin-top: 4px; font-size: 10px; }
.production-card-customer, .delivery-card-main { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.production-card-customer strong, .delivery-card-main strong { color: var(--coffee); font-size: 13px; }
.production-card-customer span, .delivery-card-main span { color: var(--muted); font-size: 11px; }
.production-card-meta, .delivery-card-details { display: grid; gap: 5px; margin: 10px 0; color: #6d6258; font-size: 11px; }
.production-card-items, .delivery-card-items { padding: 10px 11px; border-radius: 9px; color: #554a40; background: #f8f3ed; font-size: 11px; line-height: 1.7; }
.production-card-notes { margin: 10px 0 0; color: #75685d; font-size: 11px; line-height: 1.55; }
.production-card-actions, .delivery-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-top: 13px; }
.delivery-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--coffee); }
.delivery-card-actions { margin: 0; flex-wrap: wrap; }
.delivery-filter { width: 205px; }
.delivery-pendiente_entrega { color: #98651f; background: #f8efdf; }
.delivery-en_camino { color: #245f8c; background: #e8f1f8; }
.delivery-entregado { color: #397b5b; background: #eaf3ed; }
.delivery-cancelado { color: #9c3931; background: #faeae7; }
.btn-whatsapp { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; color: #fff; background: #268c59; text-decoration: none; font-size: 11px; font-weight: 700; padding: 9px 12px; }
.btn-whatsapp:hover { color: #fff; background: #1e754a; }
.admin-order-contact { margin: 13px 0 3px; }
.order-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-tools small { flex-basis: 100%; }
.order-tools button:disabled { opacity: .48; cursor: not-allowed; }
.order-history { display: grid; gap: 10px; padding: 3px 0 0; }
.history-row { display: flex; align-items: flex-start; gap: 9px; }
.history-dot { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 4px; border-radius: 50%; background: var(--caramel); }
.history-row strong { display: block; color: var(--coffee); font-size: 11px; }
.history-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

@media (max-width: 760px) {
  .side-nav { display: flex; align-items: stretch; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav:not(.production-nav) .nav-link { flex: 0 0 76px; }
  .side-nav.production-nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); max-width: 430px; margin: 0 auto; }
  .side-nav.production-nav .nav-link { min-width: 0; }
  .production-cards, .delivery-cards { grid-template-columns: 1fr; }
  .delivery-filter { width: auto; }
  .delivery-card-bottom { align-items: flex-start; flex-direction: column; }
  .delivery-card-actions { width: 100%; justify-content: flex-start; }
  .delivery-card-actions .btn { flex: 1; }
}

/* Panel exclusivo del usuario Delivery */
.side-nav.delivery-nav { grid-template-columns: 1fr; }
.driver-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.driver-order-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fffdfa; }
.driver-phone-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 7px 0 11px; color: #6d6258; font-size: 11px; }
.driver-phone-row b { color: var(--coffee); }
.driver-phone-row .btn { flex: 0 0 auto; }
.driver-card-actions { display: flex; justify-content: flex-end; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.driver-card-actions .btn { min-height: 38px; }
@media (max-width: 760px) {
  .side-nav.delivery-nav { display: grid; grid-template-columns: 1fr; max-width: 430px; margin: 0 auto; overflow: visible; }
  .side-nav.delivery-nav .nav-link { width: 100%; min-width: 0; min-height: 54px; flex: 1 1 auto; }
  .driver-cards { grid-template-columns: 1fr; }
  .driver-phone-row { align-items: flex-start; }
  .driver-card-actions .btn { width: 100%; }
}


/* Seguimiento GPS de pedidos */
.gps-share-panel { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:18px 20px; margin:0 0 18px; }
.gps-share-panel h4 { margin:0 0 5px; color:var(--coffee); font:800 15px 'Manrope',sans-serif; }
.gps-share-panel p { margin:0 0 5px; color:var(--muted); font-size:12px; }
.gps-share-panel small { color:var(--green); font-size:11px; }
.gps-share-panel button:disabled { opacity:.45; cursor:not-allowed; }
.gps-secure-warning { margin:0 0 18px; padding:12px 14px; border:1px solid #ecd4b0; border-radius:12px; color:#805323; background:#fff7e9; font-size:12px; line-height:1.5; }
.gps-privacy-note,.gps-footnote { color:var(--muted); font-size:12px; line-height:1.55; margin:0 0 14px; }
.gps-map-panel,.gps-orders-panel { padding:18px; margin-bottom:18px; }
.gps-map-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.gps-map-heading h4,.gps-orders-panel .panel-head h4 { margin:0; font:800 15px 'Manrope',sans-serif; color:var(--coffee); }
.gps-map-heading small { display:block; margin-top:4px; color:var(--muted); font-size:11px; }
.gps-legend { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:11px; white-space:nowrap; }
.gps-legend-car { font-size:19px; }
.production-gps-map { width:100%; height:440px; overflow:hidden; border-radius:12px; background:#e9e5dd; z-index:0; }
.gps-map-attribution { text-align:right; margin-top:8px; color:var(--muted); font-size:10px; }
.gps-order-list { display:grid; gap:10px; }
.gps-order-row { border:1px solid var(--line); border-radius:12px; padding:14px; background:#fff; }
.gps-order-main { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.gps-order-main strong,.gps-order-main span,.gps-order-main small { display:block; }
.gps-order-main strong { color:var(--coffee); font-size:13px; }
.gps-order-main span { margin-top:3px; font-size:12px; }
.gps-order-main small { margin-top:4px; color:var(--muted); font-size:11px; }
.gps-live-pill { padding:5px 8px; border-radius:20px; font-size:9px; font-weight:800; white-space:nowrap; background:#f0ece7; color:#75665a; }
.gps-live-pill.is-live { color:#26704e; background:#e7f3eb; }
.gps-live-pill.is-stale { color:#9a682b; background:#fbf0df; }
.gps-order-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:13px 0 8px; }
.gps-order-metrics div { min-width:0; padding:9px; border-radius:9px; background:#f8f5f0; }
.gps-order-metrics small,.gps-order-metrics strong { display:block; }
.gps-order-metrics small { color:var(--muted); font-size:10px; }
.gps-order-metrics strong { margin-top:4px; color:var(--coffee); font-size:12px; overflow-wrap:anywhere; }
.gps-destination-label { color:var(--muted); font-size:10px; }
.gps-car-marker-wrap { background:transparent; border:0; }
.gps-car-marker { display:grid; place-items:center; width:42px; height:42px; border:2px solid white; border-radius:50%; background:#62432f; box-shadow:0 2px 9px #0004; font-size:23px; }
.gps-car-marker.stale { filter:grayscale(1); opacity:.72; }
.gps-footnote { margin-top:3px; }
@media(max-width:700px) {
  .gps-share-panel { align-items:flex-start; flex-direction:column; }
  .gps-share-panel button { width:100%; }
  .gps-map-panel,.gps-orders-panel { padding:12px; }
  .production-gps-map { height:340px; }
  .gps-map-heading { align-items:flex-start; flex-direction:column; }
  .gps-order-metrics { grid-template-columns:1fr 1fr; }
  .gps-order-metrics div:last-child { grid-column:1 / -1; }
}

/* Registro y lectura OCR de guías de transporte */
.guide-modal { width:min(100%,560px); max-height:min(92vh,900px); overflow-y:auto; }
.guide-intro { margin:-4px 0 15px; font-size:12px; line-height:1.55; }
.guide-camera-box { position:relative; display:grid; place-items:center; width:100%; min-height:210px; margin-top:12px; overflow:hidden; border:1px solid var(--line); border-radius:13px; background:#211b17; }
.guide-camera-box video { display:none; width:100%; max-height:330px; object-fit:cover; }
.guide-camera-box video.is-active { display:block; }
.guide-camera-placeholder { display:flex; flex-direction:column; align-items:center; gap:7px; padding:28px 14px; color:#f8f3ed; text-align:center; }
.guide-camera-placeholder span { font-size:32px; }
.guide-camera-placeholder strong { font:700 13px 'Manrope',sans-serif; }
.guide-camera-placeholder small { color:#d3c7bd; font-size:11px; }
.guide-camera-actions { display:flex; gap:8px; margin-top:10px; }
.guide-camera-actions .btn { flex:1; }
.guide-camera-actions button:disabled { opacity:.45; cursor:not-allowed; }
.guide-ocr-status { min-height:30px; margin:10px 0; color:var(--muted); font-size:11px; line-height:1.45; }
.guide-hint { margin-top:-5px; color:var(--muted); font-size:10px; line-height:1.45; }
.guide-modal-actions { display:grid; grid-template-columns:1fr 1.5fr; }
@media(max-width:600px) {
  .guide-modal { padding:16px; }
  .guide-camera-box { min-height:180px; }
  .guide-camera-actions { flex-direction:column; }
  .guide-modal-actions { grid-template-columns:1fr; }
}


/* Alineación visual para escaneo de guías */
.guide-camera-box {
  aspect-ratio: 16 / 9;
  min-height: 190px;
  background: #17120f;
}
.guide-camera-box video,
.guide-camera-box video.is-active {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}
.guide-frame-overlay {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.guide-camera-box.camera-active .guide-frame-overlay {
  display: block;
}
.guide-frame-overlay::before {
  content: "";
  position: absolute;
  left: 5%;
  top: 13%;
  width: 90%;
  height: 74%;
  border: 2px dashed rgba(255,255,255,.92);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.12);
}
.guide-frame-label {
  position: absolute;
  left: 50%;
  top: 3%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 5px 10px;
  border-radius: 20px;
  color: #241810;
  background: rgba(255,255,255,.94);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.guide-number-target {
  position: absolute;
  left: 68%;
  top: 17%;
  width: 25%;
  height: 20%;
  border: 2px solid #f3bd57;
  border-radius: 6px;
  background: rgba(243,189,87,.12);
  box-shadow: 0 0 0 1px rgba(0,0,0,.2);
}
.guide-number-target span {
  position: absolute;
  top: -19px;
  right: 0;
  padding: 2px 5px;
  border-radius: 4px 4px 0 0;
  color: #21170f;
  background: #f3bd57;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.guide-whatsapp-modal p { line-height: 1.55; }
.guide-whatsapp-send { display: flex; justify-content: center; width: 100%; margin-top: 14px; text-decoration: none; }
.guide-whatsapp-done { width: 100%; margin-top: 10px; }
.guide-whatsapp-no-phone { color: var(--muted); }
@media(max-width:600px) {
  .guide-camera-box { min-height: 180px; }
  .guide-frame-label { font-size: 9px; }
  .guide-number-target span { font-size: 8px; }
}


/* Escáner actualizado: solo marco amarillo del número de guía */
.guide-frame-overlay::before { display: none !important; content: none !important; }
.guide-frame-label { display: none !important; }
.guide-number-target {
  left: 68%;
  top: 17%;
  width: 29%;
  height: 22%;
  border: 3px solid #ffd43b;
  border-radius: 7px;
  background: rgba(255,212,59,.10);
  box-shadow: 0 0 0 1px rgba(0,0,0,.65), 0 0 12px rgba(255,212,59,.35);
}
.guide-number-target span {
  color: #1b1607;
  background: #ffd43b;
  font-size: 10px;
  font-weight: 900;
}


/* Captura fija para OCR Python: la fotografía permanece visible tras soltar la cámara. */
.guide-camera-box .guide-captured-image {
  display: block;
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  background: #17120f;
}
.guide-camera-box .guide-captured-image[hidden] { display: none !important; }
.guide-captured-actions[hidden] { display: none !important; }
.guide-captured-actions { margin-top: 8px; }
.guide-captured-actions .btn { flex: 1; }


/* Imágenes de catálogo y vista previa en el formulario de producto */
.product-image-thumb {
  width: 52px;
  height: 52px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f3eee8;
}
.product-image-control {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px dashed #d8c9ba;
  border-radius: 12px;
  background: #fffdfa;
}
.product-image-preview-wrap {
  width: 132px;
  height: 132px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3eee8;
}
.product-image-preview-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.product-image-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.product-image-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.product-image-input-wrap input[type="file"] {
  min-height: auto;
  padding: 8px;
  font-size: 11px;
}
.product-image-input-wrap small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
@media (max-width: 560px) {
  .product-image-control { grid-template-columns: 1fr; }
  .product-image-preview-wrap { width: 112px; height: 112px; }
}
