:root {
  --bg: #170004;
  --panel: #240006;
  --panel-2: #31000b;
  --card: #fff8f3;
  --card-2: #fff1e8;
  --text: #2d1513;
  --muted: #7e625b;
  --brand: #f07249;
  --brand-2: #ffb08f;
  --cream: #fff8ee;
  --line: rgba(240,114,73,.25);
  --danger: #9f1239;
  --success: #15803d;
  --warning: #b45309;
  --shadow: 0 18px 45px rgba(20, 0, 6, .18);
  --radius: 22px;
  font-synthesis-weight: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(240,114,73,.22), transparent 35%), linear-gradient(145deg, #170004, #2b0008 60%, #120003);
  color: var(--cream);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
.app-shell { max-width: 1180px; margin: 0 auto; padding: 20px 16px 110px; }
.login-shell { max-width: 520px; margin: 0 auto; padding: 22px 16px 80px; min-height: 100vh; display: grid; align-items: center; }
.login-card, .main-card, .modal-card, .admin-login-card {
  background: rgba(255,248,243,.97);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 30px;
  box-shadow: var(--shadow);
}
.login-card { padding: 26px; }
.brand-logo { width: 106px; height: 106px; border-radius: 26px; display: block; margin: 0 auto 18px; box-shadow: 0 14px 40px rgba(0,0,0,.22); object-fit: cover; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 6vw, 44px); line-height: 1; letter-spacing: -.04em; }
h2 { font-size: clamp(22px, 4.6vw, 34px); line-height: 1.1; letter-spacing: -.03em; }
h3 { font-size: 18px; margin-bottom: 8px; }
.small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.kicker { color: var(--brand); text-transform: uppercase; font-weight: 800; letter-spacing: .13em; font-size: 11px; margin-bottom: 8px; }
.field { display: grid; gap: 8px; margin: 14px 0; }
.field label { font-weight: 750; color: #4a2722; font-size: 13px; }
.input, select, textarea {
  width: 100%; border: 1px solid #ead7ce; border-radius: 16px; background: #fff; color: var(--text);
  padding: 13px 14px; outline: none; transition: border .15s ease, box-shadow .15s ease;
}
.input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(240,114,73,.16); }
textarea { min-height: 90px; resize: vertical; }
.btn {
  border: 0; border-radius: 999px; padding: 12px 17px; font-weight: 850;
  background: #ead7ce; color: #381914; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: linear-gradient(135deg, var(--brand), #fb936f); color: #fff; box-shadow: 0 12px 24px rgba(240,114,73,.25); }
.btn.dark { background: #250006; color: #fff8f3; }
.btn.ghost { background: rgba(255,255,255,.12); color: #fff8f3; border: 1px solid rgba(255,255,255,.2); }
.btn.secondary { background: #fff1e8; color: #6b2719; border: 1px solid #f1cbbb; }
.btn.danger { background: #ffe4e6; color: var(--danger); }
.btn.success { background: #dcfce7; color: var(--success); }
.btn.warning { background: #fef3c7; color: #92400e; }
.btn.full { width: 100%; }
.btn.small-btn { padding: 8px 10px; font-size: 12px; }
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(18px); background: rgba(23,0,4,.78); border-bottom: 1px solid rgba(255,255,255,.08); margin: -20px -16px 18px; padding: 14px 16px; }
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.topbar img { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title span { color: rgba(255,248,243,.68); font-size: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 1px solid rgba(255,255,255,.16); color: #fff8f3; background: rgba(255,255,255,.08); padding: 10px 14px; border-radius: 999px; font-weight: 800; }
.tab.active { background: var(--brand); border-color: var(--brand); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.main-card { padding: 20px; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: stretch; }
.hero-panel { background: rgba(255,248,243,.97); color: var(--text); border-radius: 30px; padding: 24px; box-shadow: var(--shadow); }
.rule-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff8f3; border-radius: 26px; padding: 18px; }
.rule-card strong { color: var(--brand-2); }
.category-filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.pill { border: 1px solid #f0d1c5; background: #fff7f0; color: #5a251c; border-radius: 999px; padding: 9px 12px; font-weight: 800; white-space: nowrap; }
.pill.active { background: #250006; color: #fff8f3; border-color: #250006; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { background: #fff; color: var(--text); border: 1px solid #f0ded5; border-radius: 24px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,0,0,.06); display: flex; flex-direction: column; min-height: 100%; }
.product-image { height: 150px; display: grid; place-items: center; background: radial-gradient(circle at top, #fff2e9, #f9d7c9 80%); color: #9a3b24; font-size: 40px; position: relative; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image .badge { position: absolute; left: 12px; bottom: 12px; }
.product-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.product-title { font-weight: 900; line-height: 1.1; font-size: 17px; }
.product-meta { color: var(--muted); font-size: 13px; line-height: 1.25; }
.price { font-weight: 950; font-size: 22px; color: #2f0a08; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 900; background: #fff1e8; color: #9a3b24; border: 1px solid #f1cbbb; }
.badge.dark { background: #250006; color: #fff8f3; border: 0; }
.badge.warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge.success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge.danger { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40; max-width: 760px; margin: 0 auto; background: #fff8f3; color: var(--text); border-radius: 24px; padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.25); border: 1px solid #f0d1c5; }
.cart-bar .total { flex: 1; }
.cart-bar strong { display: block; }
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.62); display: grid; place-items: end center; padding: 14px; }
.modal-card { width: min(720px, 100%); max-height: min(88vh, 860px); overflow: auto; padding: 20px; border-radius: 28px; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-header .title { flex: 1; }
.close-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff1e8; color: #5b261d; font-weight: 900; }
.qty-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; }
.qty-control { display: inline-flex; align-items: center; border: 1px solid #ead7ce; border-radius: 999px; overflow: hidden; background: #fff; }
.qty-control button { border: 0; background: #fff1e8; width: 40px; height: 40px; font-weight: 950; color: #782c1c; }
.qty-control input { width: 64px; border: 0; text-align: center; padding: 10px 4px; outline: none; }
.line-item { background: #fff; border: 1px solid #ead7ce; border-radius: 20px; padding: 13px; display: grid; gap: 9px; }
.line-title { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.order-card { background: #fff; color: var(--text); border: 1px solid #ead7ce; border-radius: 22px; padding: 15px; box-shadow: 0 8px 24px rgba(0,0,0,.05); }
.order-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; border-top: 1px solid #f2e2da; padding-top: 10px; margin-top: 10px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #ead7ce; border-radius: 20px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #f1ded5; text-align: left; vertical-align: top; font-size: 14px; }
th { background: #fff1e8; color: #4e2119; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.receipt { background: #fff; color: #1d1d1f; border-radius: 28px; padding: 26px; box-shadow: var(--shadow); max-width: 760px; margin: 0 auto; }
.receipt-head { text-align: center; border-bottom: 1px solid #e5e5e5; padding-bottom: 18px; margin-bottom: 18px; }
.receipt-head img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
.receipt-meta { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 18px 0; }
.receipt-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid #eee; }
.receipt-total { border-top: 2px solid #ddd; display: flex; justify-content: space-between; align-items: end; padding-top: 16px; margin-top: 16px; font-size: 28px; font-weight: 950; }
.toast-zone { position: fixed; top: 14px; left: 12px; right: 12px; z-index: 120; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: #250006; color: #fff8f3; border: 1px solid rgba(255,255,255,.2); box-shadow: 0 16px 35px rgba(0,0,0,.25); padding: 12px 16px; border-radius: 999px; font-weight: 800; max-width: 760px; }
.empty { background: rgba(255,255,255,.08); border: 1px dashed rgba(255,255,255,.24); border-radius: 24px; padding: 24px; text-align: center; color: rgba(255,248,243,.78); }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; }
.status-stack { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 940px) {
  .hero, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .app-shell { padding: 16px 12px 110px; }
  .login-card, .main-card, .hero-panel { padding: 18px; border-radius: 24px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .product-image { height: 130px; }
  .topbar { margin: -16px -12px 14px; }
  .topbar-inner { gap: 9px; }
  .topbar-actions .hide-mobile { display: none; }
  .cart-bar { border-radius: 20px; }
  .receipt { padding: 18px; border-radius: 22px; }
  .receipt-item { grid-template-columns: 38px 1fr; }
  .receipt-item .amount { grid-column: 2; justify-self: start; font-weight: 900; }
}
@media print {
  body { background: #fff; color: #000; }
  .topbar, .tabs, .btn, .cart-bar { display: none !important; }
  .app-shell { padding: 0; }
  .receipt { box-shadow: none; border: 0; }
}

/* Ajustes V2 */
.close-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  font-size: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.status-select {
  border: 1px solid #ead7ce;
  border-radius: 999px;
  background: #fff8f3;
  color: #381914;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 850;
  max-width: 210px;
}
.condition-box .field { margin: 4px 0; }
.condition-box input[readonly] {
  background: #fff1e8;
  color: #6b2719;
  font-weight: 900;
}
@media (max-width: 640px) {
  .modal-card { padding: 18px; max-height: 92vh; }
  .close-btn { width: 52px; height: 52px; min-width: 52px; font-size: 28px; }
  .status-select { width: 100%; max-width: none; }
}

/* Ajustes V3 */
.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
  border-radius: 18px;
  padding: 12px 14px;
  line-height: 1.45;
}
.auto-package {
  background: #fffaf2;
  border-style: dashed;
}
.order-alert {
  outline: 2px solid #fecdd3;
}
.timeline {
  margin-top: 16px;
  border-top: 1px solid #eee;
  padding-top: 12px;
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #57534e;
}
.timeline span { font-weight: 800; color: #292524; }
.admin-login-card select, .field select {
  width: 100%;
  border: 1px solid #ead7ce;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}
textarea { min-height: 96px; }
.receipt .auto-package { background: #fffaf2; }
@media (max-width: 640px) {
  .qty-row { grid-template-columns: 1fr; align-items: stretch; }
  .qty-control { width: max-content; }
  .status-stack { gap: 7px; }
}

/* Ajustes V5 */
.in-cart-product {
  outline: 2px solid rgba(21,128,61,.28);
  box-shadow: 0 14px 32px rgba(21,128,61,.10);
}
.light-empty, .main-card .empty {
  background: #fff;
  border: 1px dashed #d9b9ab;
  color: #4a2722;
  font-weight: 800;
}
.search-row {
  grid-template-columns: minmax(0,1fr) auto;
}
.modal-actions .btn {
  width: 100%;
}
.cart-bar .btn.primary {
  min-width: 170px;
}
@media (max-width: 640px) {
  .search-row { grid-template-columns: 1fr; }
  .cart-bar { align-items: stretch; flex-direction: column; }
  .cart-bar .btn.primary { width: 100%; min-width: 0; }
  .modal-actions.grid.three { grid-template-columns: 1fr; }
}
