/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: #fff; color: var(--text);
  font: 500 13.5px var(--font);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: #C9CDC5; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(36,75,58,.25); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1B2A22; }
.btn-gold:hover { background: var(--gold-600); border-color: var(--gold-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #973630; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--primary-50); border-color: transparent; }
.btn-whatsapp { background: #E8F7EE; border-color: #BFE6CD; color: #1A7F45; }
.btn-whatsapp:hover { background: #D6F0E0; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center;
  border-radius: 9px; border: none; background: transparent; color: var(--muted);
  cursor: pointer; position: relative; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.dot-badge { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; border: 2px solid #fff; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-header.no-border { border-bottom: none; padding-bottom: 4px; }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 17px; height: 17px; color: var(--gold-600); }
.card-subtitle { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warning { color: var(--warning); } .text-gold { color: var(--gold-600); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: #F0F1EE; color: #4E5751;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-green { background: var(--success-50); color: var(--success); }
.badge-gold { background: var(--gold-50); color: var(--gold-600); }
.badge-red { background: var(--danger-50); color: var(--danger); }
.badge-orange { background: var(--warning-50); color: var(--warning); }
.badge-blue { background: var(--info-50); color: var(--info); }
.badge-purple { background: var(--purple-50); color: var(--purple); }
.badge-gray { background: #F0F1EE; color: #69716B; }
.badge-dark { background: var(--primary-50); color: var(--primary); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 14px; background: var(--primary-50); color: var(--primary); font-size: 12px; font-weight: 500; }
.chip .x { cursor: pointer; opacity: .6; }
.chip .x:hover { opacity: 1; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #FAFBF8; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { padding: 12px 14px; font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.table.compact td { padding: 8px 12px; }
.cell-main { font-weight: 550; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-flex { display: flex; align-items: center; gap: 10px; }
.thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: var(--primary-50); flex: 0 0 42px; border: 1px solid var(--border); }
.thumb.lg { width: 56px; height: 56px; flex-basis: 56px; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 10px; }
.empty-state h4 { color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* ===== Toolbar / filters ===== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search-input { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .search-input input { padding-left: 36px; }
.toolbar .search-input svg { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--muted); }
.seg { display: inline-flex; background: #F0F1EE; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; height: 30px; padding: 0 12px; border-radius: 7px; font: 500 12.5px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.tab { padding: 12px 12px; border: none; background: none; font: 500 13.5px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--gold); }
.tab .count { background: #F0F1EE; color: var(--muted); font-size: 11px; padding: 0 7px; border-radius: 9px; }
.tab.active .count { background: var(--gold-50); color: var(--gold-600); }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(19, 32, 25, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; z-index: 100; overflow-y: auto;
  animation: fadeIn .15s ease;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; animation: slideUp .2s ease;
  display: flex; flex-direction: column; max-height: 90vh;
}
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1080px; }
.modal.sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== Dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 50; animation: slideUp .15s ease;
}
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; cursor: pointer; color: var(--text); font-weight: 500; }
.dropdown-item:hover { background: var(--primary-50); text-decoration: none; }
.dropdown-item svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-header { padding: 8px 11px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.notif-menu { width: 360px; max-height: 480px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 9px; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 32px; }
.notif-icon svg { width: 16px; height: 16px; }
.notif-title { font-weight: 550; font-size: 13px; }
.notif-sub { font-size: 12px; color: var(--muted); }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 420px;
  background: #1B2A22; color: #fff; padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease; font-weight: 500;
}
.toast svg { width: 18px; height: 18px; flex: 0 0 18px; }
.toast.success svg { color: #7ED6A0; }
.toast.error { background: #5B1F1A; }
.toast.error svg { color: #FFB4AC; }
.toast.warning svg { color: var(--gold); }

/* ===== Avatars ===== */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--primary-50); color: var(--primary); flex: 0 0 36px; }
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 11.5px; }
.avatar.lg { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }

/* ===== Stat list ===== */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; text-align: right; }
.summary-list { display: flex; flex-direction: column; }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; }
.summary-row .lbl { color: var(--muted); }
.summary-row.total { border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 12px; font-size: 16px; font-weight: 700; }
.summary-row.total .lbl { color: var(--text); }
.summary-row.highlight { background: var(--gold-50); margin: 4px -10px; padding: 9px 10px; border-radius: 8px; font-weight: 600; }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; align-items: flex-start; }
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.alert-info { background: var(--info-50); color: #234E6F; }
.alert-warning { background: var(--warning-50); color: #7A5214; }
.alert-danger { background: var(--danger-50); color: #82302A; }
.alert-success { background: var(--success-50); color: #1F5A38; }

.progress { height: 6px; background: #EEF0EC; border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.progress.gold > span { background: var(--gold); }

/* ===== Product gallery ===== */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 16px; }
.p-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: box-shadow .18s, transform .18s, border-color .18s; display: flex; flex-direction: column; }
.p-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.p-card-img { aspect-ratio: 4/3; background: var(--primary-50); position: relative; overflow: hidden; }
.p-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.p-card:hover .p-card-img img { transform: scale(1.04); }
.p-card-img .badge { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.94); }
.p-card-img .p-mode { position: absolute; top: 10px; right: 10px; background: rgba(19,42,32,.78); color: #fff; font-size: 10.5px; padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: .03em; }
.p-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.p-card-cat { font-size: 11px; color: var(--gold-600); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.p-card-name { font-weight: 600; line-height: 1.3; }
.p-card-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; padding-top: 8px; }
.p-price { font-weight: 700; font-size: 15px; color: var(--primary); }
.p-price small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.avail-pill { font-size: 12px; color: var(--muted); }
.avail-pill b { color: var(--success); }

.img-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.img-strip .img-box { width: 86px; height: 86px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); position: relative; }
.img-strip .img-box img { width: 100%; height: 100%; object-fit: cover; }
.img-strip .img-box .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none; cursor: pointer; display: grid; place-items: center; font-size: 13px; }
.img-upload { width: 86px; height: 86px; border-radius: 10px; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; color: var(--muted); cursor: pointer; text-align: center; font-size: 11px; }
.img-upload:hover { border-color: var(--primary); color: var(--primary); }
.product-hero { display: grid; grid-template-columns: 360px 1fr; gap: 20px; }
.product-hero-img { border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; background: var(--primary-50); border: 1px solid var(--border); }
.product-hero-img img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; cursor: pointer; border: 2px solid transparent; }
.thumbs img.active { border-color: var(--gold); }

/* Item code tiles */
.item-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.item-tile { border: 1.5px solid var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; min-width: 120px; background: #fff; transition: border-color .15s, background .15s; user-select: none; }
.item-tile:hover { border-color: var(--primary); }
.item-tile.selected { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 0 0 0 1px var(--primary); }
.item-tile.disabled { opacity: .55; cursor: not-allowed; background: #F6F6F3; border-style: dashed; }
.item-tile .code { font-weight: 600; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.item-tile .st { font-size: 11px; color: var(--muted); }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:not(:last-child)::after { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: 0 0 28px; }
.tl-dot svg { width: 14px; height: 14px; }
.tl-title { font-weight: 550; font-size: 13px; }
.tl-sub { font-size: 12px; color: var(--muted); }

/* Status steps */
.steps { display: flex; gap: 0; align-items: center; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; background: #fff; }
.step.done { color: var(--primary); }
.step.done .n { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.current { color: var(--text); }
.step.current .n { border-color: var(--gold); color: var(--gold-600); }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 10px; min-width: 20px; }
.step-line.done { background: var(--primary); }
