/* =========================================================================
   Smart Pharma — page styles (Phase 2: token-driven, flat, dark-ready)
   ========================================================================= */

/* ============ DASHBOARD (new home) ============ */
.dash { padding: 24px 28px 30px; display: flex; flex-direction: column; gap: 24px; }
.dash-hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-greeting { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; margin: 0; }
.dash-greeting span { color: var(--accent); }
.dash-sub { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.dash-date { font-size: 13px; color: var(--ink-3); font-family: var(--mono); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-icon { width: 38px; height: 38px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; }
.kpi-icon i { width: 19px; height: 19px; }
.kpi-icon.teal { background: var(--accent-soft); color: var(--accent-ink); }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue-ink); }
.kpi-icon.amber { background: var(--warn-soft); color: var(--warn-ink); }
.kpi-icon.rose { background: var(--danger-soft); color: var(--danger-ink); }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--ink); font-family: var(--mono); letter-spacing: -0.02em; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.kpi-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; line-height: 1.35; }
.kpi-trend { font-size: 12px; font-weight: 600; }
.kpi-trend.up { color: var(--ok-ink); }
.kpi-trend.down { color: var(--danger-ink); }

.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.dash-card h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.dash-card h3 i { width: 19px; height: 19px; color: var(--accent); }
.dash-card .card-hint { font-size: 13px; color: var(--ink-2); margin: 0 0 18px; }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dash-row:last-child { border-bottom: none; }
.dash-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-row-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.dash-row-sub { font-size: 12.5px; color: var(--ink-2); }
.dash-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left;
  font-family: var(--font); transition: border-color 0.16s ease, background 0.16s ease;
}
.quick-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.quick-btn i { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.quick-btn > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick-btn .qb-title { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.quick-btn .qb-sub { font-size: 12px; color: var(--ink-2); line-height: 1.3; }

@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .dash-cols { grid-template-columns: 1fr; } }
@media (max-width: 1024px) { .dash { padding: 18px 16px 24px; } }
@media (max-width: 600px) { .kpi-grid { grid-template-columns: 1fr; } .dash-quick { grid-template-columns: 1fr; } }

/* ============ INVENTORY ============ */
.inventory-table-wrapper { margin: 0 28px 28px; }
.inventory-table-container { background: var(--surface); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--sh-1); border: 1px solid var(--line); overflow-x: auto; }
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.table-title { font-size: 19px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 11px; letter-spacing: -0.01em; }
.table-title i { width: 20px; height: 20px; color: var(--accent); }
.add-item-btn { background: var(--accent); color: var(--on-accent); border: none; padding: 11px 18px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.16s ease; display: flex; align-items: center; gap: 8px; font-family: var(--font); }
.add-item-btn:hover { background: var(--accent-strong); }
.add-item-btn i { width: 16px; height: 16px; }
.table-header-actions { display: flex; align-items: center; gap: 12px; }
.density-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.density-toggle button { border: none; background: var(--surface); color: var(--ink-3); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; transition: background 0.16s ease, color 0.16s ease; }
.density-toggle button + button { border-left: 1px solid var(--line); }
.density-toggle button:hover { background: var(--surface-2); color: var(--ink); }
.density-toggle button.active { background: var(--accent-soft); color: var(--accent-ink); }
.density-toggle button i { width: 17px; height: 17px; }
.inventory-table.compact td { padding: 9px 18px; }
.inventory-table.compact .item-icon { width: 34px; height: 34px; }
.inventory-table.compact .item-icon i { width: 16px; height: 16px; }

.inventory-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inventory-table th { text-align: left; padding: 14px 18px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--line-strong); }
.inventory-table th.sortable { cursor: pointer; user-select: none; transition: color 0.15s ease; }
.inventory-table th.sortable:hover { color: var(--ink); }
.inventory-table th.sortable[aria-sort="ascending"], .inventory-table th.sortable[aria-sort="descending"] { color: var(--accent-ink); }
.inventory-table th .sort-ind { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; margin-left: 5px; }
.inventory-table th .sort-ind.inactive { opacity: 0.35; }
.inventory-table td { padding: 18px; color: var(--ink); border-bottom: 1px solid var(--line); vertical-align: middle; }
.inventory-table tr:hover td { background: var(--surface-2); }
.item-cell { display: flex; align-items: center; gap: 14px; }
.item-icon { width: 44px; height: 44px; background: var(--accent-soft); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); border: 1px solid var(--line); flex-shrink: 0; }
.item-icon i { width: 20px; height: 20px; }
.item-info { flex: 1; }
.item-name { font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.item-detail { font-size: 12.5px; color: var(--ink-2); }
.category-badge { padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; }
.category-otc { background: var(--blue-soft); color: var(--blue-ink); }
.category-prescription { background: var(--danger-soft); color: var(--danger-ink); }
.stock-frame { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: 12.5px; min-width: 64px; justify-content: center; cursor: pointer; }
.stock-frame i { width: 13px; height: 13px; }
.stock-frame.editing { background: var(--surface) !important; border: 2px solid var(--accent); padding: 4px 10px; }
.stock-input { width: 56px; border: none; outline: none; font-weight: 600; font-size: 13px; text-align: center; background: transparent; color: var(--ink); font-family: var(--mono); }
.stock-instock { background: var(--ok-soft); color: var(--ok-ink); }
.stock-low { background: var(--warn-soft); color: var(--warn-ink); }
.stock-outofstock { background: var(--danger-soft); color: var(--danger-ink); }
.price-cell-content { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.price-value { font-weight: 600; color: var(--ink); font-size: 14px; font-family: var(--mono); }
.inventory-table .refund-widget { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink); display: inline-block; }
.actions-cell { display: flex; gap: 8px; align-items: center; }
.actions-cell .action-btn { width: 34px; height: 34px; border: none; border-radius: var(--r-sm); cursor: pointer; transition: all 0.16s ease; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: none; }
.action-edit { background: var(--blue-soft); color: var(--blue-ink); }
.action-edit:hover { background: var(--blue); color: #fff; }
.action-confirm { background: var(--ok-soft); color: var(--ok-ink); }
.action-confirm:hover { background: var(--ok); color: #fff; }
.actions-cell .action-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.actions-cell .action-btn.disabled:hover { transform: none; }
.action-orders { background: var(--warn-soft); color: var(--warn-ink); }
.action-orders:hover { background: var(--warn); color: #fff; }
.actions-cell .action-btn i { width: 16px; height: 16px; }

@media (max-width: 1024px) { .inventory-table-wrapper { margin: 0 16px 20px; } }
@media (max-width: 900px) {
  .inventory-table thead { display: none; }
  .inventory-table, .inventory-table tbody, .inventory-table tr, .inventory-table td { display: block; width: 100%; }
  .inventory-table tr { background: var(--surface); border-radius: var(--r-md); margin-bottom: 14px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
  .inventory-table td { display: flex; justify-content: space-between; align-items: center; padding: 11px 15px; border-bottom: 1px solid var(--line); text-align: right; }
  .inventory-table td:last-child { border-bottom: none; }
  .inventory-table td::before { content: attr(data-label); font-weight: 600; color: var(--ink); text-align: left; margin-right: 15px; white-space: nowrap; }
  .inventory-table-container { padding: 15px; overflow-x: hidden; }
  .actions-cell { justify-content: flex-end; }
}

/* ============ ORDERS ============ */
.order-main-container { margin: 22px 28px 28px; background: var(--surface); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.order-number { font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.order-number .code { font-family: var(--mono); }
.order-date { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.section-title i { width: 20px; height: 20px; color: var(--accent); }
.order-items-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.order-items-table th { text-align: left; padding: 13px 16px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--line-strong); }
.order-items-table td { padding: 15px 16px; color: var(--ink); border-bottom: 1px solid var(--line); vertical-align: middle; }
.order-items-table tr:hover td { background: var(--surface-2); }
.item-name-cell { display: flex; align-items: center; gap: 13px; }
.order-items-table .item-icon { width: 38px; height: 38px; }
.sku-cell { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.quantity-input { width: 68px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; text-align: center; background: var(--surface); color: var(--ink); outline: none; font-family: var(--mono); }
.quantity-input:focus-visible { border-color: var(--accent); box-shadow: none; }
.warehouse-select { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 13px; background: var(--surface); color: var(--ink); cursor: pointer; outline: none; font-family: var(--font); }
.warehouse-select:focus-visible { border-color: var(--accent); box-shadow: none; }
.action-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--danger-soft); border-radius: var(--r-sm); cursor: pointer; color: var(--danger-ink); transition: all 0.16s ease; border: none; }
.action-icon:hover { background: var(--danger); color: #fff; }
.action-icon i { width: 16px; height: 16px; }
.price-cell { font-weight: 600; color: var(--ink); font-size: 13px; font-family: var(--mono); }
.total-cell { font-weight: 700; color: var(--ink); font-size: 14px; font-family: var(--mono); }
.ord-stock-low { color: var(--danger-ink); font-weight: 700; font-family: var(--mono); }
.ord-stock-medium { color: var(--warn-ink); font-weight: 700; font-family: var(--mono); }
.ord-stock-high { color: var(--ok-ink); font-weight: 700; font-family: var(--mono); }
.order-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.order-item-count { font-size: 14px; color: var(--ink-2); }
.order-total { font-size: 18px; font-weight: 700; color: var(--ink); font-family: var(--mono); }
.order-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.order-actions .action-button { padding: 11px 18px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; width: auto; margin: 0; transition: background 0.16s ease; font-family: var(--font); }
.order-actions .action-button span { flex: none; }
.order-actions .action-button.secondary { background: var(--blue); color: #fff; }
.order-actions .action-button.secondary:hover { background: var(--blue-strong); }
.order-actions .action-button.primary { background: var(--accent); color: var(--on-accent); }
.order-actions .action-button.primary:hover { background: var(--accent-strong); }
.order-actions .action-button i { width: 16px; height: 16px; margin: 0; }

@media (max-width: 1024px) { .order-main-container { margin: 16px; } }
@media (max-width: 900px) {
  .order-items-table thead { display: none; }
  .order-items-table, .order-items-table tbody, .order-items-table tr, .order-items-table td { display: block; width: 100%; }
  .order-items-table tr { background: var(--surface); border-radius: var(--r-md); margin-bottom: 14px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
  .order-items-table td { display: flex; justify-content: space-between; align-items: center; padding: 11px 15px; border-bottom: 1px solid var(--line); text-align: right; }
  .order-items-table td:last-child { border-bottom: none; }
  .order-items-table td::before { content: attr(data-label); font-weight: 600; color: var(--ink); text-align: left; margin-right: 15px; white-space: nowrap; }
  .item-name-cell { justify-content: flex-end; }
  .action-icon { margin-left: auto; }
  .order-actions { flex-wrap: wrap; }
}

/* ============ PRESCRIPTIONS ============ */
.rx-lookup-card { margin: 22px 28px; background: var(--surface); border-radius: var(--r-lg); padding: 26px 28px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
.lookup-subtitle { color: var(--ink-2); font-size: 15px; margin-bottom: 20px; }
.input-row { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.input-group { flex: 1; min-width: 250px; }
.input-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.input-field { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 15px; background: var(--surface); transition: border-color 0.16s ease, box-shadow 0.16s ease; color: var(--ink); font-family: var(--mono); }
.input-field:focus { border-color: var(--accent); box-shadow: none; }
.input-field:focus-visible { border-color: var(--accent); box-shadow: none; }
.input-field::placeholder { color: var(--ink-3); font-family: var(--font); }
.search-button { background: var(--accent); color: var(--on-accent); border: none; padding: 14px 28px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.16s ease; display: flex; align-items: center; gap: 10px; font-family: var(--font); }
.search-button:hover { background: var(--accent-strong); }
.search-button i { width: 18px; height: 18px; }
.loading { display: none; text-align: center; padding: 40px; }
.loading.show { display: block; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 16px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.rx-details-view { display: none; margin: 0 28px 28px; }
.rx-details-view.show { display: block; }
.details-grid-container { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.rx-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
.rx-card + .rx-card { margin-top: 18px; }
.block-title { font-size: 17px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 11px; margin-bottom: 16px; letter-spacing: -0.01em; }
.block-title i { width: 19px; height: 19px; color: var(--accent); }
.med-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 12px; flex-wrap: wrap; }
.med-item:last-child { margin-bottom: 0; }
.med-info { flex: 1; min-width: 240px; }
.item-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.medication-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.medication-icon i { width: 18px; height: 18px; }
.med-name { font-weight: 700; color: var(--ink); font-size: 15px; }
.med-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.med-sub strong { color: var(--ink); font-weight: 600; }
.med-controls { display: flex; align-items: center; gap: 16px; }
.med-pricing { display: flex; align-items: center; gap: 12px; }
.item-refund { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink); }
.med-price { font-weight: 700; color: var(--ink); font-size: 15px; font-family: var(--mono); }
.quantity-control { display: flex; align-items: center; gap: 6px; }
.quantity-btn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); width: 30px; height: 30px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.16s ease; color: var(--ink-2); }
.quantity-btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--ink); }
.quantity-btn i { width: 15px; height: 15px; }
.item-quantity { font-weight: 600; color: var(--ink); font-size: 15px; width: 24px; text-align: center; font-family: var(--mono); }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 13px; color: var(--ink-2); }
.detail-value { font-size: 14px; font-weight: 600; color: var(--ink); text-align: right; }
.detail-value.code { font-family: var(--mono); font-weight: 500; font-size: 13px; }
.rx-status-tile { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.rx-status-tile i { width: 15px; height: 15px; }
.status-active { background: var(--ok-soft); color: var(--ok-ink); }
.status-expired { background: var(--danger-soft); color: var(--danger-ink); }
.add-all-cart-btn { width: 100%; margin-top: 18px; padding: 15px 18px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--on-accent); background: var(--accent); transition: background 0.16s ease; font-family: var(--font); }
.add-all-cart-btn:hover { background: var(--accent-strong); }
.add-all-cart-btn i { width: 18px; height: 18px; }

@media (max-width: 1024px) { .rx-lookup-card, .rx-details-view { margin-left: 16px; margin-right: 16px; } .details-grid-container { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .input-row { flex-direction: column; } }

/* ============ REPORTS ============ */
.reports-section { margin: 24px 28px 0; }
.reports-section:last-child { margin-bottom: 28px; }
.category-header { display: flex; align-items: center; gap: 15px; padding-bottom: 15px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.category-icon { width: 44px; height: 44px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.category-icon i { width: 22px; height: 22px; }
.category-icon.financial { background: var(--accent-soft); color: var(--accent-ink); }
.category-icon.regulatory { background: var(--blue-soft); color: var(--blue-ink); }
.category-title { font-size: 24px; font-weight: 700; color: var(--ink); margin: 0; flex: 1; letter-spacing: -0.02em; }
.category-subtitle { font-size: 14px; color: var(--ink-2); }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.report-tile { background: var(--surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-1); border: 1px solid var(--line); cursor: pointer; transition: border-color 0.16s ease, box-shadow 0.16s ease; display: flex; flex-direction: column; }
.report-tile:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.report-tile:focus-visible { border-color: var(--accent); box-shadow: var(--ring); }
.report-title { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0 0 14px; letter-spacing: -0.01em; }
.report-description { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; flex: 1; margin: 0 0 20px; }
.report-stats { display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 1px solid var(--line); }
.report-frequency { font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-3); padding: 5px 13px; border-radius: 999px; }
.report-last-run { font-size: 12.5px; color: var(--ink-3); }

@media (max-width: 1024px) { .reports-section { margin-left: 16px; margin-right: 16px; } }

/* ============ SHOPPING CART ============ */
.cart-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; margin: 22px 28px 28px; }
.cart-items-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
.cart-line { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 12px; }
.cart-line:last-child { margin-bottom: 0; }
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.cart-line-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.cart-line-price { font-weight: 700; color: var(--ink); font-size: 15px; white-space: nowrap; font-family: var(--mono); }
.summary-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--sh-1); border: 1px solid var(--line); position: sticky; top: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 14.5px; color: var(--ink-2); }
.summary-row span:last-child { font-family: var(--mono); color: var(--ink); }
.summary-row.total { border-top: 1px solid var(--line-strong); margin-top: 8px; padding-top: 16px; font-size: 19px; font-weight: 700; color: var(--ink); }
.summary-row.total span { white-space: nowrap; }
.summary-row.total span:last-child { color: var(--ink); }
.summary-row .refund-amount { color: var(--ok-ink); font-weight: 600; }
.checkout-btn { width: 100%; margin-top: 18px; padding: 15px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--on-accent); background: var(--accent); transition: background 0.16s ease; font-family: var(--font); }
.checkout-btn:hover { background: var(--accent-strong); }
.checkout-btn i { width: 18px; height: 18px; }
.remove-item-btn { border: none; }

@media (max-width: 1024px) { .cart-layout { grid-template-columns: 1fr; margin-left: 16px; margin-right: 16px; } }

/* ============ SETTINGS ============ */
.settings-wrapper { margin: 22px 28px 28px; display: flex; flex-direction: column; gap: 18px; max-width: 920px; }
.settings-card { background: var(--surface); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--sh-1); border: 1px solid var(--line); }
.settings-card h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0 0 4px; display: flex; align-items: center; gap: 11px; letter-spacing: -0.01em; }
.settings-card h3 i { width: 19px; height: 19px; color: var(--accent); }
.settings-card .settings-hint { font-size: 13.5px; color: var(--ink-2); margin: 0 0 20px; }
.settings-field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.settings-field { display: flex; flex-direction: column; gap: 8px; }
.settings-field.full { grid-column: 1 / -1; }
.settings-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.settings-field input, .settings-field select { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; background: var(--surface); outline: none; font-family: var(--font); color: var(--ink); }
.settings-field input:focus-visible, .settings-field select:focus-visible { border-color: var(--accent); box-shadow: none; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); gap: 16px; }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-label { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.toggle-row .toggle-desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--surface-3); border-radius: 26px; cursor: pointer; transition: background 0.2s; border: 1px solid var(--line); }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: var(--sh-1); }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }
.settings-save-btn { align-self: flex-start; padding: 13px 28px; border-radius: var(--r-md); font-size: 14.5px; font-weight: 600; border: none; cursor: pointer; color: var(--on-accent); background: var(--accent); transition: background 0.16s ease; font-family: var(--font); }
.settings-save-btn:hover { background: var(--accent-strong); }

/* theme picker (settings) */
.theme-choice { display: flex; gap: 14px; }
.theme-opt {
  flex: 1; max-width: 200px; display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  cursor: pointer; font-family: var(--font); transition: border-color 0.16s ease, background 0.16s ease;
}
.theme-opt:hover { border-color: var(--accent); }
.theme-opt.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-opt-label { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.theme-swatch { width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-swatch i { width: 18px; height: 18px; }
.theme-swatch.light { background: oklch(96% 0.01 85); color: oklch(50% 0.1 70); border: 1px solid var(--line); }
.theme-swatch.dark { background: oklch(25% 0.01 60); color: oklch(85% 0.05 250); border: 1px solid var(--line); }
.font-opt { flex: 1; max-width: 130px; justify-content: center; }
.font-demo { width: 30px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--accent-ink); line-height: 1; }

@media (max-width: 1024px) { .settings-wrapper { margin-left: 16px; margin-right: 16px; } }
@media (max-width: 768px) { .settings-field-row { grid-template-columns: 1fr; } }

/* ============ COMMAND PALETTE ============ */
.cmdk-overlay { position: fixed; inset: 0; background: oklch(20% 0.02 60 / 0.45); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: flex-start; z-index: 1400; opacity: 0; transition: opacity 0.18s ease; }
.cmdk-overlay.show { display: flex; opacity: 1; }
.cmdk { width: 90%; max-width: 600px; margin-top: 12vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); overflow: hidden; transform: translateY(-10px); transition: transform 0.18s ease; }
.cmdk-overlay.show .cmdk { transform: translateY(0); }
.cmdk-input-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cmdk-input-row i { width: 19px; height: 19px; color: var(--ink-3); }
.cmdk-input-row input { flex: 1; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); font-family: var(--font); }
.cmdk-input-row input::placeholder { color: var(--ink-3); }
.cmdk-hint { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-family: var(--mono); }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmdk-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); padding: 10px 12px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-item .cmdk-ic { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.cmdk-item .cmdk-ic i { width: 17px; height: 17px; }
.cmdk-item .cmdk-label { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.cmdk-item .cmdk-sub { font-size: 12.5px; color: var(--ink-2); }
.cmdk-item.active, .cmdk-item:hover { background: var(--accent-soft); }
.cmdk-empty { padding: 32px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- Payment / checkout ---------- */
.pay-box { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); width: 92%; max-width: 460px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; transform: translateY(16px); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1); }
.modal-overlay.show .pay-box { transform: translateY(0); }
.pay-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.pay-head h3 { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink); }
.pay-body { padding: 24px; overflow-y: auto; }
.pay-due { text-align: center; margin-bottom: 22px; }
.pay-due .lbl { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.pay-due .amt { font-size: 36px; font-weight: 700; color: var(--ink); font-family: var(--mono); letter-spacing: -0.02em; margin-top: 4px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-method { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--ink); transition: border-color 0.16s ease, background 0.16s ease; }
.pay-method:hover { border-color: var(--accent); background: var(--accent-soft); }
.pay-method i { width: 30px; height: 30px; color: var(--accent); }
.pay-spinner { width: 52px; height: 52px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 8px auto 20px; }
.pay-center { text-align: center; padding: 12px 0; }
.pay-center .pay-state { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.pay-center .pay-hint { font-size: 14px; color: var(--ink-2); }
.pay-success-icon { width: 64px; height: 64px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.pay-success-icon i { width: 34px; height: 34px; }
.pay-cash-field { margin: 18px 0; }
.pay-cash-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.pay-cash-field input { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 20px; font-family: var(--mono); text-align: right; background: var(--surface); color: var(--ink); outline: none; }
.pay-cash-field input:focus { border-color: var(--accent); }
.pay-change-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--accent-soft); border-radius: var(--r-md); margin-bottom: 18px; }
.pay-change-row .lbl { font-size: 14px; font-weight: 600; color: var(--accent-ink); }
.pay-change-row .val { font-size: 20px; font-weight: 700; color: var(--accent-ink); font-family: var(--mono); }
.pay-quick-cash { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pay-quick-cash button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: var(--mono); }
.pay-quick-cash button:hover { border-color: var(--accent); background: var(--accent-soft); }
.pay-receipt-sum { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; margin-bottom: 18px; font-size: 14px; }
.pay-receipt-sum .r { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--ink-2); line-height: 1.4; }
.pay-receipt-sum .r span:first-child { white-space: nowrap; }
.pay-receipt-sum .r span:last-child { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.pay-receipt-sum .r.total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 16px; color: var(--ink); }
.pay-btn { width: 100%; padding: 14px; border-radius: var(--r-md); font-size: 15px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font); display: flex; align-items: center; justify-content: center; gap: 9px; }
.pay-btn.primary { background: var(--accent); color: var(--on-accent); }
.pay-btn.primary:hover { background: var(--accent-strong); }
.pay-btn.primary:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
.pay-btn.ghost { background: var(--surface-2); color: var(--ink); margin-top: 10px; }
.pay-btn.ghost:hover { background: var(--surface-3); }
.pay-btn i { width: 18px; height: 18px; }
.pay-register-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 16px; }
.pay-register-note.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pay-register-note.fail { background: var(--danger-soft); color: var(--danger-ink); }
.pay-register-note i { width: 17px; height: 17px; flex-shrink: 0; }
.pay-register-note .resend { margin-left: auto; background: none; border: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; font-family: var(--font); font-size: 13px; }

@media (max-width: 600px) { .cmdk-hint { display: none; } }

/* ---------- Cart drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: oklch(20% 0.02 60 / 0.5); backdrop-filter: blur(4px);
  display: none; justify-content: flex-end; z-index: 1300; opacity: 0; transition: opacity 0.22s ease;
}
.drawer-overlay.show { display: flex; opacity: 1; }
.drawer {
  width: 420px; max-width: 92vw; height: 100%; background: var(--surface);
  display: flex; flex-direction: column; box-shadow: var(--sh-3);
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.2,0.8,0.2,1);
}
.drawer-overlay.show .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.drawer-head h3 i { width: 19px; height: 19px; color: var(--accent); }
.drawer-close { background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--r-sm); color: var(--ink-2); display: flex; }
.drawer-close:hover { background: var(--surface-2); }
.drawer-close i, .drawer-close svg { width: 20px; height: 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-foot { padding: 18px 22px; border-top: 1px solid var(--line); }
.drawer-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.drawer-line:last-child { border-bottom: none; }
.drawer-line .medication-icon { width: 34px; height: 34px; }
.drawer-line-info { flex: 1; min-width: 0; }
.drawer-line-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.drawer-line-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.drawer-line-price { font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--ink); white-space: nowrap; }
.drawer-line .quantity-control { gap: 4px; }
.drawer-empty { text-align: center; color: var(--ink-3); padding: 48px 16px; }
.drawer-empty i { width: 44px; height: 44px; opacity: 0.6; margin-bottom: 12px; }
.drawer-foot .summary-row { padding: 6px 0; font-size: 14px; }
.drawer-foot .summary-row.total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 12px; font-size: 18px; font-weight: 700; color: var(--ink); }
.drawer-foot .summary-row span:last-child { font-family: var(--mono); }
.drawer-foot .refund-amount { color: var(--ok-ink); font-weight: 600; }
.drawer-actions { display: flex; gap: 10px; margin-top: 14px; }
.drawer-actions button { flex: 1; padding: 13px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; border: none; cursor: pointer; font-family: var(--font); display: flex; align-items: center; justify-content: center; gap: 8px; }
.drawer-actions .ghost { background: var(--surface-2); color: var(--ink-2); flex: 0 0 auto; padding: 13px 16px; }
.drawer-actions .ghost:hover { background: var(--surface-3); }
.drawer-actions .primary { background: var(--accent); color: var(--on-accent); }
.drawer-actions .primary:hover { background: var(--accent-strong); }
.drawer-actions .primary i, .drawer-actions .ghost i { width: 17px; height: 17px; }

/* ---------- Shortcuts help ---------- */
.shortcuts-box { width: 90%; max-width: 480px; margin-top: 14vh; align-self: flex-start; margin-left: auto; margin-right: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); overflow: hidden; }
.shortcuts-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.shortcuts-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); }
.shortcuts-list { padding: 12px 22px 22px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-row .sc-label { font-size: 14px; color: var(--ink); }
.shortcut-row .sc-keys { display: flex; gap: 6px; }
.sc-keys kbd { font-family: var(--mono); font-size: 12px; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 3px 8px; }
