:root {
  --navy: #102f61;
  --navy-deep: #0b2348;
  --blue: #1463dc;
  --blue-soft: #eff5ff;
  --canvas: #f5f7fb;
  --surface: #ffffff;
  --stroke: #e4e9f2;
  --text: #172e4e;
  --muted: #75839a;
  --danger: #c43b4c;
  --green: #178568;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 14px; color: var(--text); }
button, input, select { font: inherit; }
a { text-decoration: none; }
.app-body { margin: 0; background: var(--canvas); min-height: 100vh; }
.side-nav {
  width: 234px; position: fixed; left: 0; top: 0; bottom: 0; background: var(--navy-deep);
  padding: 27px 15px 20px; display: flex; flex-direction: column; z-index: 1020;
}
.brand-lockup, .mobile-brand, .login-brand { display: flex; align-items: center; gap: 11px; }
.brand-lockup { color: white; padding: 5px 9px; margin-bottom: 35px; }
.brand-lockup:hover { color: white; }
.brand-mark { width: 39px; height: 39px; background: white; border-radius: 12px; display: inline-grid; place-items: center; flex: none; overflow: hidden; }
.brand-mark img { width: 29px; height: 29px; object-fit: contain; }
.brand-lockup strong { display: block; font-size: 14px; font-weight: 800; letter-spacing: -.035em; }
.brand-lockup small { display: block; color: #a5b9d7; font-size: 10px; letter-spacing: .015em; margin-top: 1px; }
.side-links { display: grid; gap: 6px; }
.side-link { color: #b7c8e1; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 11px; font-weight: 600; transition: background .15s, color .15s; }
.side-link i { font-size: 19px; line-height: 1; }
.side-link:hover { color: white; background: rgba(255,255,255,.09); }
.side-link.active { color: white; background: #1b477f; }
.side-logout { margin-top: auto; }
.mobile-header, .mobile-bottom-nav { display: none; }
.app-main { margin-left: 234px; min-height: 100vh; padding: 31px clamp(20px, 3.2vw, 48px) 65px; }
.page-width { max-width: 1300px; margin-inline: auto; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 19px; }
.page-heading h1 { font-size: clamp(22px, 2vw, 28px); letter-spacing: -.05em; line-height: 1.25; font-weight: 800; margin: 0 0 4px; overflow-wrap: anywhere; }
.page-heading p { color: var(--muted); font-size: 12px; margin: 0; font-weight: 500; }
.btn { font-size: 13px; font-weight: 700; border-radius: 10px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; padding: 9px 15px; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn-sm { padding: 6px 11px; min-height: 34px; font-size: 12px; border-radius: 9px; }
.btn i { font-size: 15px; }
.btn-brand { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.btn-brand:hover, .btn-brand:focus { color: white; background: #0d52bd; border-color: #0d52bd; }
.btn-outline-brand { color: var(--blue); background: #f2f7ff; border: 1px solid #d7e6ff; }
.btn-outline-brand:hover, .btn-outline-brand:focus { color: #0d52bd; background: #e5efff; border-color: #c9dbfc; }
.btn-light-outline { background: white; color: #526b8a; border: 1px solid var(--stroke); }
.btn-light-outline:hover, .btn-light-outline:focus { color: var(--text); background: #f5f8fc; border-color: #cfdbe9; }
.btn-subtle { background: #f2f5fa; color: #45617e; border: 1px solid #eef1f5; }
.btn-subtle:hover, .btn-subtle:focus { background: #e7edf6; color: var(--text); }
.btn-icon-danger { color: var(--danger); background: transparent; border: 1px solid transparent; padding-inline: 9px; }
.btn-icon-danger:hover, .btn-icon-danger:focus { color: var(--danger); background: #fff2f4; border-color: #ffe3e7; }
.surface { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: 0 3px 14px rgba(16, 47, 97, .025); }
.tools-surface { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; margin-bottom: 16px; }
.search-form { display: flex; gap: 9px; flex: 1; min-width: 0; max-width: 700px; }
.search-field { display: flex; gap: 10px; align-items: center; padding: 0 13px; border: 1px solid #dce5f1; background: #f9fbfe; border-radius: 10px; flex: 1; min-width: 0; }
.search-field i { color: #8a9ab3; font-size: 16px; }
.search-field input { width: 100%; border: 0; outline: 0; background: none; min-height: 40px; min-width: 0; font-weight: 500; color: var(--text); }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,99,220,.09); }
.expiry-trigger { border: 1px solid #e9e2cf; background: #fffaf0; color: #8e6729; min-height: 39px; padding: 8px 11px; font-weight: 700; }
.expiry-trigger:hover { background: #fff3d8; color: #805f2b; }
.count-pill { display: inline-grid; place-items: center; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 999px; background: #f5e8c7; font-variant-numeric: tabular-nums; font-size: 11px; }
.listing-surface { overflow: hidden; }
.surface-heading { padding: 16px 21px; border-bottom: 1px solid var(--stroke); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.surface-heading h2 { margin: 0 0 3px; font-size: 15px; font-weight: 800; letter-spacing: -.025em; }
.surface-heading span { font-size: 11px; font-weight: 500; color: var(--muted); }
.ui-table { --bs-table-hover-bg: #f7faff; --bs-table-bg: transparent; font-size: 12.5px; color: var(--text); }
.ui-table thead th { color: #8090a5; background: #fafbfd; font-size: 10.5px; text-transform: uppercase; letter-spacing: .035em; font-weight: 800; border-bottom: 1px solid var(--stroke); white-space: nowrap; padding: 14px 17px; }
.ui-table tbody td { padding: 13px 17px; border-bottom: 1px solid #edf1f7; vertical-align: middle; }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table strong { font-weight: 700; }
.inventory-table .medicine-name { min-width: 180px; max-width: 400px; }
.inventory-table .medicine-name strong { display: block; white-space: normal; line-height: 1.5; }
.inventory-table .batch-col { max-width: 150px; overflow-wrap: anywhere; color: #637691; }
.inventory-table .unit-col { color: #637691; }
.inventory-table .price-col { white-space: nowrap; }
.inventory-table .action-col { width: 1%; white-space: nowrap; }
.table-actions { display: flex; gap: 5px; align-items: center; }
.mobile-meta, .mobile-unit { display: none; }
.empty-list { text-align: center; padding: 44px 14px; color: var(--muted); }
.empty-list i { display: block; font-size: 27px; margin-bottom: 7px; color: #9eb0c9; }
.empty-list p { margin: 0; font-size: 13px; }
.pagination-wrap { display: flex; gap: 5px; justify-content: center; align-items: center; padding-top: 17px; flex-wrap: wrap; }
.page-circle { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; border: 1px solid var(--stroke); border-radius: 10px; background: white; color: #4d627e; font-size: 12px; font-weight: 700; padding: 0 6px; }
.page-circle.active { color: white; background: var(--blue); border-color: var(--blue); }
.page-circle.disabled { opacity: .35; pointer-events: none; }
.page-circle:hover:not(.disabled):not(.active) { background: var(--blue-soft); }
.inline-error { font-size: 12px; color: var(--danger); margin: 0 0 14px; border-left: 3px solid #edc5cc; padding: 5px 10px; }
.modal-content { border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden; box-shadow: 0 18px 70px rgba(4,27,67,.16); }
.modal-header { padding: 19px 23px; border-color: var(--stroke); }
.modal-title { font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.modal-body { padding: 20px 23px 12px; }
.modal-footer { border-color: var(--stroke); padding: 13px 23px 16px; gap: 8px; }
.modal-footer .btn { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 7px; color: #425a7b; font-size: 12px; font-weight: 700; }
.field .muted { color: var(--muted); font-weight: 400; }
.form-control, .form-select { font-family: inherit; color: var(--text); font-size: 13px; min-height: 42px; background-color: #fbfcff; border: 1px solid #dae4f0; border-radius: 10px; padding: 9px 12px; box-shadow: none; }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,99,220,.10); }
.filter-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.filter-pill { color: #59708d; background: #f5f8fc; border: 1px solid #e7ebf3; border-radius: 999px; padding: 7px 11px; font-size: 11px; font-weight: 700; }
.filter-pill.active { color: var(--blue); background: var(--blue-soft); border-color: #cfe0ff; }
.expiry-row { display: grid; gap: 3px; padding: 11px 0; border-bottom: 1px solid var(--stroke); grid-template-columns: 1fr auto; }
.expiry-row:last-child { border-bottom: 0; }
.expiry-row strong { font-size: 12px; font-weight: 700; }
.expiry-row span { color: #9b6933; font-weight: 700; font-size: 11px; white-space: nowrap; }
.expiry-row small { grid-column: 1 / -1; color: var(--muted); }
.back-link { color: #627995; display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 11px; margin-bottom: 12px; }
.back-link:hover { color: var(--blue); }
.stock-heading { margin-bottom: 16px; }
.stock-summary { display: grid; grid-template-columns: 1.1fr .95fr .95fr; padding: 17px 18px; margin-bottom: 16px; }
.stock-summary > div { padding-inline: 17px; min-width: 0; border-right: 1px solid var(--stroke); }
.stock-summary > div:first-child { padding-left: 2px; }
.stock-summary > div:last-child { border-right: 0; }
.stock-summary span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.stock-summary strong { display: block; font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.stock-summary .summary-focus { font-size: 23px; line-height: 1; color: var(--blue); }
.stock-summary .summary-focus small { font-size: 12px; color: #63809c; font-weight: 600; }
.stock-summary .clip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-surface-heading { align-items: center; }
.month-filter { display: flex; align-items: center; gap: 7px; }
.month-filter .form-control { min-height: 36px; width: 160px; padding-block: 5px; }
.month-filter .btn { min-height: 36px; }
.icon-action { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: #60758e; }
.icon-action:hover { background: #f0f4fa; color: var(--blue); }
.stock-table { min-width: 730px; }
.stock-table .expiry-cell { white-space: nowrap; }
.expiry-cell time { display: block; font-weight: 600; }
.expiry-countdown { display: block; margin-top: 3px; font-size: 10.5px; line-height: 1.35; font-weight: 650; color: #627892; }
.expiry-countdown.is-soon { color: #a46a12; }
.expiry-countdown.is-expired { color: #c43e47; }
.mobile-expiry .expiry-countdown { display: inline; margin: 0 0 0 5px; font-size: inherit; }

.stock-table td { white-space: normal; }
.stock-table .nowrap { white-space: nowrap; }
.stock-positive { font-weight: 800; color: var(--green); }
.stock-negative { font-weight: 800; color: var(--danger); }
.mobile-stock-list { display: none; }
.report-filter { display: grid; grid-template-columns: minmax(110px, 1.3fr) minmax(90px, .7fr) minmax(200px, 1.6fr) auto; align-items: end; gap: 14px; padding: 18px; margin-bottom: 16px; }
.check-line { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; margin: 0; font-size: 12px; color: #58708d; font-weight: 600; cursor: pointer; }
.check-line input { accent-color: var(--blue); width: 15px; height: 15px; }
.report-section, .value-section { margin-bottom: 16px; overflow: hidden; }
.ranking-list { padding: 4px 18px; }
.ranking-item { display: flex; align-items: center; gap: 14px; padding: 11px 5px; border-bottom: 1px solid var(--stroke); min-height: 61px; color: var(--text); }
.ranking-item:last-child { border-bottom: 0; }
.ranking-item:hover { color: var(--blue); }
.rank-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #f1f5fb; font-size: 12px; font-weight: 800; flex: none; }
.ranking-item:nth-child(-n+3) .rank-number { color: #0e60d5; background: #eaf2ff; }
.ranking-name { display: block; min-width: 0; flex: 1; }
.ranking-name strong { display: block; font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.ranking-name small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 4px; }
.ranking-total { display: flex; gap: 4px; align-items: baseline; text-align: right; flex: none; }
.ranking-total strong { font-size: 15px; font-weight: 800; }
.ranking-total small { font-size: 10.5px; color: var(--muted); }
.ranking-arrow { font-size: 11px; color: #9aacbf; }
.subtle-footnote { color: var(--muted); font-size: 11px; margin: 0; padding: 2px 23px 14px; }
.compact-empty { padding: 27px 10px; }
.value-highlight { padding: 21px 22px 16px; }
.value-highlight > span, .value-highlight > small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
.value-highlight strong { display: block; color: var(--navy); font-size: clamp(23px, 2.7vw, 32px); letter-spacing: -.04em; margin: 5px 0; font-weight: 800; }
.value-highlight > small { font-weight: 400; }
.value-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin: 0 22px 15px; padding-top: 12px; border-top: 1px solid var(--stroke); }
.value-metrics > div + div { padding-left: 18px; border-left: 1px solid var(--stroke); }
.value-metrics span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.value-metrics strong { display: block; margin-top: 4px; color: var(--text); font-size: 18px; font-weight: 800; }
.data-remark { color: #9e5e27; font-size: 11px; padding: 0 22px 13px; margin: 0; }
.detail-section { overflow: hidden; }
.detail-section summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-size: 14px; font-weight: 800; padding: 17px 21px; }
.detail-section summary::-webkit-details-marker { display: none; }
.detail-summary-right { color: var(--muted); font-size: 11px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.detail-section[open] summary { border-bottom: 1px solid var(--stroke); }
.detail-section[open] summary .bi { transform: rotate(180deg); }
.detail-section .bi { transition: transform .2s; }
.report-table .name-column { min-width: 185px; }
.mobile-export { display: none; }
.login-body { background: var(--canvas); min-height: 100vh; margin: 0; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(100%, 410px); background: white; border-radius: 20px; border: 1px solid var(--stroke); padding: 35px; box-shadow: 0 14px 45px rgba(16,47,97,.05); }
.login-brand { font-weight: 800; font-size: 15px; margin-bottom: 29px; }
.login-panel h1 { font-size: 24px; font-weight: 800; letter-spacing: -.04em; margin: 0 0 25px; }
.login-panel .field { margin-bottom: 16px; }
.login-button { margin-top: 10px; min-height: 45px; }
@media (max-width: 1199.98px) {
  .stock-table-wrap { display: none; }
  .mobile-stock-list { display: block; }
  .stock-mobile-row { padding: 13px 18px; border-bottom: 1px solid var(--stroke); }
  .stock-mobile-row:last-child { border-bottom: 0; }
  .stock-mobile-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
  .stock-mobile-top time { font-size: 12px; font-weight: 800; }
  .stock-small-meta { font-size: 11px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
  .stock-amount { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .stock-mobile-bottom { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 5px; }
  .stock-mobile-bottom > span { font-size: 10.5px; color: var(--muted); }
  .stock-mobile-bottom .icon-action { width: 30px; height: 30px; }
  .danger-icon { color: var(--danger); }
}
@media (max-width: 991.98px) {
  .side-nav { display: none; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; height: 59px; padding: 0 19px; background: white; border-bottom: 1px solid var(--stroke); position: sticky; top: 0; z-index: 1020; }
  .mobile-brand { color: var(--navy); font-size: 14px; font-weight: 800; }
  .mobile-brand .brand-mark { width: 35px; height: 35px; border: 1px solid #edf1f7; }
  .mobile-brand .brand-mark img { width: 27px; height: 27px; }
  .mobile-bottom-nav { display: grid; grid-template-columns: 1fr 1fr 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; padding: 7px max(12px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--stroke); box-shadow: 0 -3px 17px rgba(9,30,60,.045); }
  .mobile-bottom-nav .bottom-link, .mobile-bottom-nav .bottom-add { border: 0; background: none; display: flex; flex-direction: column; gap: 3px; justify-content: center; align-items: center; font-size: 10px; font-weight: 700; color: #8593aa; min-height: 48px; }
  .mobile-bottom-nav i { font-size: 19px; line-height: 1.2; }
  .mobile-bottom-nav .bottom-link.active { color: var(--blue); }
  .mobile-bottom-nav .bottom-add { color: var(--blue); }
  .mobile-bottom-nav .bottom-add i { width: 35px; height: 35px; color: white; background: var(--blue); display: inline-grid; place-items: center; border-radius: 11px; font-size: 22px; }
  .app-main { margin-left: 0; padding: 25px 19px calc(95px + env(safe-area-inset-bottom)); }
  .desktop-add { display: none; }
  .mobile-export { display: inline-flex; font-size: 11px; min-height: 33px; padding: 5px 9px; }
}
@media (max-width: 767.98px) {
  .page-heading { margin-bottom: 14px; }
  .page-heading h1 { font-size: 21px; }
  .tools-surface { padding: 11px; gap: 7px; }
  .search-form { gap: 7px; }
  .search-form > .btn { padding-inline: 11px; }
  .expiry-trigger { font-size: 0; min-width: 36px; width: 39px; padding: 5px; gap: 0; display: inline-grid; grid-template-columns: auto auto; }
  .expiry-trigger i { font-size: 15px; }
  .expiry-trigger .count-pill { font-size: 9px; min-width: 17px; height: 17px; }
  .inventory-table-wrap { overflow: visible; }
  .inventory-table { display: block; }
  .inventory-table thead { display: none; }
  .inventory-table tbody { display: block; }
  .inventory-table .medicine-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 12px; padding: 13px 15px; border-bottom: 1px solid var(--stroke); }
  .inventory-table .medicine-row:last-child { border-bottom: 0; }
  .inventory-table tbody td { display: block; border: 0; padding: 0; min-width: 0; }
  .inventory-table .medicine-name { max-width: none; grid-column: 1 / -1; }
  .inventory-table .medicine-name strong { font-size: 12px; line-height: 1.4; }
  .inventory-table .mobile-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
  .inventory-table .batch-col, .inventory-table .unit-col { display: none; }
  .inventory-table .price-col { grid-column: 1; grid-row: 2; font-size: 12px; }
  .inventory-table .action-col { grid-column: 2; grid-row: 2; width: auto; white-space: normal; }
  .inventory-table .table-actions .btn { min-height: 32px; }
  .inventory-table .table-actions .btn-icon-danger { width: 31px; padding: 4px; }
  .surface-heading { padding: 14px 15px; }
  .surface-heading h2 { font-size: 14px; }
  .stock-summary { padding: 13px 11px; margin-bottom: 13px; }
  .stock-summary > div { padding-inline: 10px; }
  .stock-summary > div:first-child { padding-left: 1px; }
  .stock-summary span { font-size: 10px; margin-bottom: 6px; }
  .stock-summary strong { font-size: 12px; }
  .stock-summary .summary-focus { font-size: 21px; }
  .stock-summary .summary-focus small { font-size: 10px; }
  .stock-surface-heading { align-items: flex-start; flex-wrap: wrap; }
  .month-filter { margin-left: auto; }
  .month-filter .form-control { width: 154px; }
  .report-filter { grid-template-columns: 1fr 1fr; gap: 11px; padding: 14px; }
  .report-filter .check-line { grid-column: 1 / -1; padding-bottom: 0; }
  .report-filter > .btn { grid-column: 1 / -1; }
  .ranking-list { padding: 4px 13px; }
  .ranking-item { gap: 10px; min-height: 61px; }
  .ranking-name strong { font-size: 11.5px; }
  .ranking-total strong { font-size: 14px; }
  .ranking-arrow { display: none; }
  .value-highlight { padding: 17px 16px 14px; }
  .value-highlight strong { font-size: 25px; }
  .value-metrics { margin-inline: 16px; }
  .report-table-wrap { overflow: visible; }
  .report-table { display: block; }
  .report-table thead { display: none; }
  .report-table tbody { display: block; }
  .report-table tbody tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 14px; padding: 12px 15px; border-bottom: 1px solid var(--stroke); }
  .report-table tbody td { display: block; padding: 0!important; border: none; }
  .report-table .desktop-cell { display: none; }
  .report-table .name-column { grid-column: 1; grid-row: 1; min-width: 0; }
  .report-table .name-column strong { font-size: 11.5px; }
  .report-table .mobile-meta { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
  .report-table .stock-cell { grid-column: 1; grid-row: 2; text-align: left!important; font-size: 10.5px; color: var(--muted); }
  .report-table .mobile-unit { display: inline; }
  .report-table .value-cell { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; font-weight: 800; font-size: 12px; }
}
@media (max-width: 420px) {
  .mobile-header { padding-inline: 14px; }
  .app-main { padding: 19px 12px calc(95px + env(safe-area-inset-bottom)); }
  .tools-surface { flex-wrap: wrap; }
  .expiry-trigger { width: 37px; }
  .search-field { padding-inline: 9px; }
  .search-form > .btn { padding-inline: 9px; }
  .inventory-table .medicine-row { padding: 12px; }
  .inventory-table .table-actions { gap: 3px; }
  .inventory-table .table-actions .btn-sm { padding: 5px 7px; font-size: 11px; }
  .form-grid { gap: 12px; }
}
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { border: 0; border-radius: 0; min-height: 100dvh; }
  .modal-fullscreen-sm-down .modal-body { overflow-y: auto; }
  .modal-fullscreen-sm-down .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-sm .modal-content { border-radius: 16px; }
  .login-page { padding: 14px; }
  .login-panel { padding: 25px 22px; border-radius: 15px; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: .01ms!important; animation-duration: .01ms!important; } }

/* SVG ringan menggantikan pustaka font ikon. */
.ui-icon { width: 1.15em; height: 1.15em; vertical-align: -.13em; display: inline-block; flex-shrink: 0; }
.side-link .ui-icon { width: 19px; height: 19px; }
.search-field .ui-icon { width: 16px; height: 16px; color: #8a9ab3; }
.icon-action .ui-icon { width: 18px; height: 18px; }
.empty-list .ui-icon { width: 28px; height: 28px; color: #9eb0c9; margin-bottom: 8px; }
.ranking-arrow.ui-icon { width: 13px; height: 13px; }
.mobile-bottom-nav .ui-icon { width: 19px; height: 19px; }
.mobile-bottom-nav .bottom-add .ui-icon { width: 35px; height: 35px; color: white; background: var(--blue); padding: 6px; border-radius: 11px; }
@media(max-width:767.98px){ .expiry-trigger .ui-icon { width: 15px; height: 15px; } }
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down .modal-content { height: 100dvh; display: flex; flex-direction: column; }
  .modal-fullscreen-sm-down .modal-content > form { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .modal-fullscreen-sm-down .modal-body { flex: 1; overflow-y: auto; }
  .modal-fullscreen-sm-down .modal-footer { margin-top: auto; background: white; }
}


.js-rupiah { font-variant-numeric: tabular-nums; }

.page-loader {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(245, 247, 251, .78); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, visibility .22s ease; z-index: 2000;
}
body.is-loading { overflow: hidden; }
body.is-loading .page-loader { opacity: 1; visibility: visible; pointer-events: auto; }
.page-loader__scene {
  width: 116px; height: 116px; border-radius: 32px; background: rgba(255,255,255,.82);
  border: 1px solid rgba(228,233,242,.95); box-shadow: 0 16px 40px rgba(16,47,97,.12);
  display: grid; place-items: center; position: relative;
}
.loader-orbit {
  position: absolute; inset: 17px; border-radius: 28px; border: 2px solid rgba(20,99,220,.12);
}
.loader-orbit::after {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 999px;
  background: linear-gradient(135deg, #6ea8ff, #1463dc); top: -7px; left: calc(50% - 7px);
  box-shadow: 0 0 0 6px rgba(20,99,220,.08); animation: orbit-run 1.35s linear infinite;
}
.loader-pills { display: flex; gap: 8px; align-items: flex-end; }
.pill { width: 14px; border-radius: 999px; display: inline-block; animation: pill-bounce 1s ease-in-out infinite; }
.pill-a { height: 34px; background: linear-gradient(180deg, #8fc2ff, #1463dc); animation-delay: 0s; }
.pill-b { height: 26px; background: linear-gradient(180deg, #a6b5ff, #5764ff); animation-delay: .14s; }
.pill-c { height: 20px; background: linear-gradient(180deg, #7be2d0, #15a38c); animation-delay: .28s; }
.loader-dots { position: absolute; bottom: 18px; display: flex; gap: 5px; }
.loader-dots span { width: 6px; height: 6px; border-radius: 999px; background: #c2d0e4; animation: dot-fade 1.1s ease-in-out infinite; }
.loader-dots span:nth-child(2) { animation-delay: .18s; }
.loader-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes orbit-run { from { transform: rotate(0deg) translateY(38px) rotate(0deg); } to { transform: rotate(360deg) translateY(38px) rotate(-360deg); } }
@keyframes pill-bounce { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-8px) scaleY(1.06); } }
@keyframes dot-fade { 0%, 80%, 100% { opacity: .25; transform: scale(.9); } 40% { opacity: 1; transform: scale(1.2); } }

/* Teks loading muncul bersama animasi hanya pada perpindahan yang cukup lama. */
.page-loader__wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; padding: 16px; }
.page-loader__message { margin: 0; min-height: 21px; font-size: 13px; font-weight: 700; color: var(--navy); letter-spacing: -.015em; text-align: center; }
@media (prefers-reduced-motion: reduce) {
  .page-loader, .pill, .loader-orbit::after, .loader-dots span { animation: none !important; transition: none !important; }
}
