:root {
  color-scheme: light;
  --ink: #1c2330;
  --muted: #68717f;
  --line: #dfe3e8;
  --soft-line: #eceff2;
  --paper: #f7f5f1;
  --white: #ffffff;
  --navy: #24324a;
  --navy-deep: #171d28;
  --navy-soft: #e8edf4;
  --amber: #d99a2b;
  --amber-soft: #fff5df;
  --green: #1d7a50;
  --green-soft: #e9f5ee;
  --blue: #326da8;
  --blue-soft: #eaf2fb;
  --red: #b94949;
  --red-soft: #fdeeee;
  --shadow: 0 14px 34px rgba(20, 29, 43, 0.07);
  --sidebar-width: 244px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(217, 154, 43, .28); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--paper); color: var(--muted); }
.boot-screen img { width: 52px; height: 52px; object-fit: contain; animation: boot-pulse 1.15s ease-in-out infinite alternate; }
.boot-screen p { margin: 0; font-size: .8rem; font-weight: 750; letter-spacing: .04em; }
@keyframes boot-pulse { to { transform: translateY(-3px); opacity: .68; } }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 540px) minmax(360px, 1fr); background: var(--white); }
.login-panel { position: relative; z-index: 1; width: min(100%, 470px); margin: auto; padding: 48px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 70px; }
.login-brand img { width: 52px; height: 52px; object-fit: contain; }
.login-brand div { display: grid; }
.login-brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; }
.login-brand span { color: var(--muted); font-size: .76rem; }
.login-copy h1 { margin: 7px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; font-weight: 600; letter-spacing: -.035em; }
.login-copy > p:last-child { margin: 0; color: var(--muted); }
.login-form { display: grid; gap: 15px; margin-top: 30px; }
.login-form label { display: block; margin-bottom: -8px; color: #414957; font-size: .78rem; font-weight: 750; }
.login-form input { position: relative; z-index: 1; width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbd2da; border-radius: 6px; background: white; color: var(--ink); cursor: text; pointer-events: auto; user-select: text; touch-action: manipulation; }
.login-form .button { width: 100%; margin-top: 3px; }
.form-error { margin: -3px 0 0; padding: 10px 11px; border-left: 3px solid var(--red); background: var(--red-soft); color: #8c3535; font-size: .78rem; }
.secure-note { display: flex; align-items: center; gap: 7px; margin: 22px 0 0; color: var(--muted); font-size: .72rem; }
.secure-note svg { width: 15px; height: 15px; color: var(--green); }
.auth-aside { display: flex; flex-direction: column; justify-content: center; padding: clamp(48px, 8vw, 120px); background: var(--navy-deep); color: white; }
.auth-aside .kicker { color: var(--amber); }
.auth-aside h2 { max-width: 720px; margin: 18px 0 34px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 5vw, 5rem); line-height: 1.02; font-weight: 500; letter-spacing: -.045em; }
.auth-facts { display: grid; gap: 14px; color: #c6ced9; }
.auth-facts span { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.auth-facts svg { width: 17px; height: 17px; color: var(--amber); }

.topbar { position: fixed; inset: 0 0 auto 0; z-index: 40; height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; background: rgba(255,255,255,.98); border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.eyebrow, .kicker, .section-label { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.greeting { margin: 1px 0 0; font-size: .95rem; font-weight: 700; }
.menu-toggle { display: none !important; }
.profile-wrap { position: relative; }
.profile-control { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px 4px 4px; background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.profile-control:hover, .profile-control[aria-expanded="true"] { background: #f5f6f8; border-color: var(--line); }
.profile-control > svg { width: 16px; height: 16px; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: white; font-size: .75rem; font-weight: 800; letter-spacing: .05em; }
.profile-copy { display: grid; text-align: left; line-height: 1.2; }
.profile-copy strong { font-size: .84rem; }
.profile-copy small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.profile-menu { position: absolute; top: 52px; right: 0; width: 210px; padding: 6px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.profile-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: .86rem; cursor: pointer; }
.profile-menu button:hover { background: #f5f6f8; }
.profile-menu svg { width: 16px; height: 16px; }

.sidebar { position: fixed; top: 68px; bottom: 0; left: 0; z-index: 30; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 24px 18px 18px; background: var(--navy-deep); color: #f3f5f8; overflow-y: auto; }
.brand-block { display: flex; align-items: center; gap: 10px; padding: 0 8px 23px; border-bottom: 1px solid rgba(255,255,255,.11); }
.brand-block img { width: 42px; height: 42px; object-fit: contain; }
.brand-block div { display: grid; min-width: 0; }
.brand-block strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; letter-spacing: .01em; }
.brand-block span { color: #aeb7c4; font-size: .7rem; }
.nav-list { display: grid; gap: 4px; padding: 20px 0; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 0; border-radius: 7px; background: transparent; color: #bdc5d0; text-align: left; font-size: .9rem; font-weight: 650; cursor: pointer; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: rgba(255,255,255,.065); color: white; }
.nav-item.active { background: #303e56; color: white; box-shadow: inset 3px 0 0 var(--amber); }
.quick-actions { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.11); }
.quick-actions p { margin: 0 10px 9px; color: #7f8998; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.quick-actions button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: #b9c1cc; text-align: left; font-size: .82rem; cursor: pointer; }
.quick-actions button:hover { background: rgba(255,255,255,.06); color: white; }
.quick-actions svg { width: 16px; height: 16px; color: var(--amber); }
.sidebar-foot { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 18px 9px 2px; color: #8f99a8; font-size: .7rem; line-height: 1.35; }
.sync-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #49b37b; box-shadow: 0 0 0 3px rgba(73,179,123,.12); }
.sidebar-backdrop { display: none; }

.main-content { min-height: 100vh; margin-left: var(--sidebar-width); padding: 104px 32px 30px; }
.page-intro { max-width: 1220px; margin: 0 auto 22px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-intro h1, .card-heading h2, .modal h2, .confirm-modal h2 { margin: 5px 0 0; font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.02em; color: #1c2533; }
.page-intro h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.03; }
.page-intro > div > p:last-child { margin: 9px 0 0; color: var(--muted); }
.intro-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; font-size: .88rem; font-weight: 750; cursor: pointer; }
.button svg { width: 17px; height: 17px; }
.button-primary { background: var(--navy); color: white; border-color: var(--navy); }
.button-primary:hover { background: #18243a; }
.button-secondary { background: var(--white); color: var(--ink); border-color: #cfd5dc; }
.button-secondary:hover { background: #f3f5f7; }
.button-danger { background: var(--red); color: white; border-color: var(--red); }

.metrics-grid { max-width: 1220px; margin: 0 auto 18px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.metric-card, .overview-card, .table-card, .activity-card { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric-card { position: relative; min-height: 132px; padding: 18px; overflow: hidden; border-radius: 9px; }
.metric-card p { margin: 0 0 9px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.metric-card strong { display: block; font-size: 1.65rem; letter-spacing: -.03em; }
.metric-card .delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: .72rem; font-weight: 800; }
.metric-card .delta svg { position: static; width: 13px; height: 13px; opacity: 1; }
.delta.positive { color: var(--green); }.delta.neutral { color: var(--blue); }.delta.warning { color: #a06a06; }
.metric-card > svg { position: absolute; right: 14px; bottom: 15px; width: 88px; height: 28px; fill: none; stroke: var(--amber); stroke-width: 2.2; opacity: .88; }

.overview-card, .table-card, .activity-card { max-width: 1220px; margin: 0 auto 18px; border-radius: 10px; }
.overview-card { padding: 22px 24px 17px; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.card-heading h2 { font-size: 1.38rem; }
.week-total { display: grid; gap: 1px; text-align: right; }
.week-total span, .table-summary span { color: var(--muted); font-size: .75rem; }
.week-total strong, .table-summary strong { font-size: 1rem; }
.chart-wrap { position: relative; margin-top: 12px; padding-left: 42px; }
.sales-chart { display: block; width: 100%; height: 210px; overflow: visible; }
.chart-grid line { stroke: var(--soft-line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--navy); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(36,50,74,.06); stroke: none; }
#chartPoints circle { fill: var(--white); stroke: var(--amber); stroke-width: 3; }
.y-axis { position: absolute; top: 7px; bottom: 24px; left: 0; display: flex; flex-direction: column; justify-content: space-between; color: #8c939c; font-size: .68rem; }
.x-axis { display: grid; grid-template-columns: repeat(7,1fr); padding: 0 1.5%; color: #7d858f; font-size: .7rem; text-align: center; }

.table-card { overflow: hidden; }
.card-heading.compact { align-items: center; padding: 20px 22px 14px; }
.table-summary { display: grid; text-align: right; }
.table-scroll { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 16px; text-align: left; border-top: 1px solid var(--soft-line); font-size: .82rem; }
th { background: #fafbfc; color: #67707c; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
td { color: #303744; }
td strong { display: block; color: var(--ink); font-size: .85rem; }
td small { color: var(--muted); font-size: .69rem; }
.status { display: inline-flex; align-items: center; min-width: 76px; padding: 4px 8px; border: 1px solid transparent; border-radius: 999px; font-size: .68rem; font-weight: 800; }
.status.in-stock { color: var(--green); background: var(--green-soft); border-color: #cde5d6; }
.status.low-stock { color: #93620d; background: var(--amber-soft); border-color: #efd9a8; }
.status.out-stock { color: var(--red); background: var(--red-soft); border-color: #f3caca; }
.row-action { width: 34px; height: 34px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.row-action:hover { background: #f2f4f6; border-color: var(--line); color: var(--ink); }
.row-action svg { width: 17px; height: 17px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 13px 16px; border-top: 1px solid var(--soft-line); }
.pagination > span { margin-right: auto; color: var(--muted); font-size: .75rem; }
.pagination #pageButtons { display: flex; gap: 5px; }
.page-button, .icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); cursor: pointer; }
.page-button { font-size: .76rem; font-weight: 750; }
.page-button.active { background: var(--navy); border-color: var(--navy); color: white; }
.icon-button:hover, .page-button:hover { background: #f3f5f7; }
.icon-button:disabled { opacity: .4; cursor: not-allowed; }
.icon-button svg { width: 17px; height: 17px; }

.activity-card { padding: 21px 22px 10px; }
.activity-heading { align-items: center; padding-bottom: 13px; }
.filters { display: flex; gap: 8px; }
.select-control, .date-control { position: relative; display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: #535c69; font-size: .76rem; }
.select-control svg, .date-control svg { flex: 0 0 auto; width: 15px; height: 15px; }
.select-control select { appearance: none; min-width: 102px; padding: 0 18px 0 0; border: 0; background: transparent; color: inherit; font-size: inherit; cursor: pointer; }
.select-control::after { content: "⌄"; position: absolute; right: 8px; top: 7px; pointer-events: none; }
.date-control { overflow: hidden; cursor: pointer; }
.date-control input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.activity-list { border-top: 1px solid var(--soft-line); }
.activity-item { display: grid; grid-template-columns: 40px minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--soft-line); }
.activity-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; }
.activity-icon.sale { color: var(--green); background: var(--green-soft); }
.activity-icon.restock { color: var(--blue); background: var(--blue-soft); }
.activity-icon.product { color: #99620a; background: var(--amber-soft); }
.activity-icon svg { width: 17px; height: 17px; }
.activity-copy strong { display: block; font-size: .84rem; }
.activity-copy span { color: var(--muted); font-size: .72rem; }
.activity-time { color: var(--muted); font-size: .72rem; }
.activity-amount { min-width: 74px; text-align: right; font-size: .82rem; font-weight: 800; }
.activity-amount.sale { color: var(--green); }.activity-amount.restock { color: var(--blue); }
.empty-state { padding: 28px 8px; color: var(--muted); text-align: center; font-size: .86rem; }
.text-button { margin: 10px 0 2px auto; padding: 6px 0; display: block; border: 0; background: transparent; color: var(--blue); font-size: .75rem; font-weight: 750; cursor: pointer; }
.site-footer { max-width: 1220px; margin: 28px auto 0; display: flex; justify-content: space-between; gap: 16px; color: #7a828d; font-size: .72rem; }

.modal { width: min(92vw, 510px); padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); box-shadow: 0 28px 80px rgba(18,25,36,.22); }
.modal::backdrop { background: rgba(17,23,32,.54); backdrop-filter: blur(2px); }
.modal form { padding: 23px; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.modal h2 { font-size: 1.55rem; }
.modal label { display: grid; gap: 7px; margin-top: 14px; color: #414957; font-size: .78rem; font-weight: 750; }
.modal input, .modal select { width: 100%; min-height: 43px; padding: 9px 10px; border: 1px solid #ccd2da; border-radius: 6px; background: white; color: var(--ink); font-size: .88rem; }
.modal input[readonly] { background: #f3f5f7; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note { margin-top: 13px; padding: 10px 11px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #765417; font-size: .76rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.confirm-modal { padding: 26px; text-align: center; }
.confirm-modal p { color: var(--muted); }
.confirm-modal .modal-actions { justify-content: center; }
.confirm-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; background: var(--red-soft); color: var(--red); }
.confirm-icon svg { width: 21px; height: 21px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 80; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 9px; min-width: 260px; max-width: 360px; padding: 12px 14px; border: 1px solid #cbd5df; border-left: 4px solid var(--green); border-radius: 7px; background: white; box-shadow: var(--shadow); font-size: .82rem; font-weight: 700; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--red); }
.toast svg { width: 17px; height: 17px; color: var(--green); }
.toast.error svg { color: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.delta.negative { color: var(--red); }
.delta:empty { display: none; }
.week-total small { color: var(--muted); font-size: .7rem; }
.table-tools { display: flex; align-items: center; gap: 18px; }
.check-control { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 700; cursor: pointer; }
.check-control input { width: 15px; height: 15px; accent-color: var(--navy); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
tr.archived td { color: var(--muted); }
tr.archived td strong { color: var(--muted); text-decoration: line-through; }
.status.archived { color: var(--muted); background: #f1f3f5; border-color: var(--line); }
.search-control { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: #535c69; }
.search-control svg { flex: 0 0 auto; width: 15px; height: 15px; }
.search-control input { width: 170px; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .76rem; }
.activity-icon.adjustment { color: #7a4fb0; background: #f3eefb; }
.activity-icon.edit, .activity-icon.archive { color: var(--muted); background: #f1f3f5; }
.activity-amount.adjustment { color: #7a4fb0; }
.activity-copy em { display: block; color: var(--muted); font-size: .7rem; font-style: normal; }
.activity-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 6px; }
.activity-foot .text-button { margin: 0; }
.activity-foot .button { margin-left: auto; min-height: 36px; font-size: .78rem; }
.button-danger-outline { background: var(--white); color: var(--red); border-color: #efc4c4; }
.button-danger-outline:hover { background: var(--red-soft); }
.modal-actions.split { justify-content: space-between; }
.modal-actions.split > span { display: flex; gap: 8px; }
.account-summary { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--soft-line); border-radius: 8px; background: #fafbfc; }
.account-summary .avatar { flex: 0 0 auto; width: 44px; height: 44px; font-size: .85rem; }
.account-summary div { display: grid; min-width: 0; line-height: 1.3; }
.account-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary small { color: var(--muted); font-size: .75rem; }
.account-summary small span { color: var(--ink); font-weight: 700; }
.strength { display: grid; gap: 5px; margin-top: 8px; }
.strength-bar { display: block; height: 5px; overflow: hidden; border-radius: 999px; background: var(--soft-line); }
.strength-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--red); transition: width .2s ease, background-color .2s ease; }
.strength-bar span.fair { background: var(--amber); }
.strength-bar span.good { background: var(--blue); }
.strength-bar span.strong { background: var(--green); }
.strength small { color: var(--muted); font-size: .72rem; }
.modal label.show-passwords { display: inline-flex; grid-auto-flow: column; gap: 7px; margin-top: 12px; color: var(--muted); font-size: .76rem; }
.modal label.show-passwords input { width: 15px; min-height: 0; height: 15px; padding: 0; }

@media (max-width: 1040px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { flex-wrap: wrap; }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; background: var(--paper); }
  .login-panel { width: min(100%, 520px); padding: 42px 26px; }
  .login-brand { margin-bottom: 48px; }
  .auth-aside { display: none; }
  .menu-toggle { display: inline-grid !important; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: 18px 0 50px rgba(13,18,27,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 68px 0 0; z-index: 25; border: 0; background: rgba(17,23,32,.38); }
  .sidebar-backdrop.visible { display: block; }
  .main-content { margin-left: 0; padding: 96px 22px 24px; }
  .profile-copy { display: none; }
  .page-intro { align-items: flex-start; }
}

@media (max-width: 640px) {
  .login-panel { padding: 30px 20px; }
  .login-brand { margin-bottom: 42px; }
  .login-copy h1 { font-size: 2.55rem; }
  .topbar { height: 64px; padding: 0 14px; }
  .sidebar { top: 64px; }
  .sidebar-backdrop { inset: 64px 0 0; }
  .main-content { padding: 88px 14px 22px; }
  .page-intro, .card-heading, .activity-heading { display: grid; }
  .page-intro h1 { font-size: 2.15rem; }
  .intro-actions { width: 100%; justify-content: stretch; }
  .intro-actions .button { flex: 1 1 0; min-width: 0; padding-inline: 10px; white-space: nowrap; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .overview-card { padding: 18px 13px 14px; }
  .week-total, .table-summary { text-align: left; }
  .chart-wrap { padding-left: 32px; }
  .sales-chart { height: 180px; }
  .activity-card { padding: 18px 14px 8px; }
  .filters { width: 100%; }
  .filters label { flex: 1; }
  .activity-item { grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; }
  .activity-time { grid-column: 2; }
  .activity-amount { grid-column: 3; grid-row: 1 / span 2; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .modal-actions .button { flex: 1; }
  .modal-actions.split { flex-wrap: wrap; }
  .modal-actions.split > span { flex: 1 1 100%; }
  .table-tools { justify-content: space-between; width: 100%; }
  .search-control { flex: 1 1 100%; }
  .search-control input { width: 100%; }
  .site-footer { display: grid; }
}

@media (max-width: 430px) {
  .intro-actions { display: grid; grid-template-columns: 1fr; }
  .intro-actions .button { width: 100%; }
  .greeting { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Store settings */
.modal.modal-wide { width: min(94vw, 640px); }
.setup-intro { margin: -6px 0 6px; color: var(--muted); font-size: .86rem; }
.logo-field { display: flex; align-items: center; gap: 14px; margin-top: 6px; padding: 12px; border: 1px solid var(--soft-line); border-radius: 8px; background: #fafbfc; }
.logo-field img { flex: 0 0 auto; width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: var(--white); border: 1px solid var(--soft-line); }
.logo-field > div { display: grid; gap: 2px; min-width: 0; }
.logo-field strong { font-size: .86rem; }
.logo-field small { color: var(--muted); font-size: .74rem; }
.logo-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.modal label.file-button { position: relative; display: inline-flex; margin: 0; min-height: 36px; padding: 6px 12px; overflow: hidden; color: var(--ink); font-size: .8rem; cursor: pointer; }
.modal label.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-actions .text-button { margin: 0; color: var(--red); }
.login-brand img, .brand-block img { border-radius: 8px; }

@media (max-width: 640px) {
  .logo-field { align-items: flex-start; }
}

/* Accessibility helpers */
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 10px 14px; border-radius: 6px; background: var(--navy); color: white; font-weight: 750; text-decoration: none; }
.skip-link:focus { top: 12px; }
.main-content:focus { outline: none; }
a:focus-visible, .row-action:focus-visible, .nav-item:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(217, 154, 43, .55); outline-offset: 2px; }
.field-help { display: block; margin-top: -6px; color: var(--muted); font-size: .74rem; }

/* Tables: row headers look like the first data cell */
tbody th { padding: 13px 16px; border-top: 1px solid var(--soft-line); background: transparent; color: #303744; font-size: .82rem; font-weight: 400; letter-spacing: 0; text-align: left; text-transform: none; }
tbody th strong { display: block; color: var(--ink); font-size: .85rem; font-weight: 700; }
tbody th small { color: var(--muted); font-size: .69rem; }
tr.archived th strong { color: var(--muted); text-decoration: line-through; }
.status.neutral { color: var(--blue); background: var(--blue-soft); border-color: #cfe0f2; min-width: 0; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--navy-soft); color: var(--navy); font-size: .64rem; font-weight: 800; letter-spacing: .02em; vertical-align: middle; }
.activity-icon.warning { color: var(--red); background: var(--red-soft); }

/* Cards and forms used by Staff, Security log and My account */
.info-card { max-width: 1220px; margin: 0 auto 18px; padding: 20px 22px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.info-card h2 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; font-weight: 600; color: #1c2533; }
.account-grid { max-width: 1220px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.account-grid .info-card { margin: 0; }
.account-wide { grid-column: 1 / -1; }
.stacked-form label { display: grid; gap: 7px; margin-top: 14px; color: #414957; font-size: .78rem; font-weight: 750; }
.stacked-form input { width: 100%; min-height: 43px; padding: 9px 10px; border: 1px solid #ccd2da; border-radius: 6px; background: white; color: var(--ink); font-size: .88rem; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--soft-line); }
.setting-row:first-of-type { border-top: 0; padding-top: 2px; }
.setting-row > div { display: grid; gap: 2px; }
.setting-row strong { font-size: .88rem; }
.setting-row small { color: var(--muted); font-size: .76rem; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.card-heading.flush { padding: 0 0 8px; align-items: center; }
.card-heading.flush h2 { margin: 0; }
.button.small { min-height: 34px; padding: 6px 11px; font-size: .78rem; }
.session-list { margin: 0; padding: 0; list-style: none; }
.session-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--soft-line); }
.session-item > svg { width: 20px; height: 20px; color: var(--muted); }
.session-item div { display: grid; gap: 2px; min-width: 0; }
.session-item strong { font-size: .86rem; }
.session-item small { color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.role-list { display: grid; gap: 10px; margin: 0; }
.role-list div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.role-list dt { font-weight: 800; font-size: .86rem; }
.role-list dd { margin: 0; color: var(--muted); font-size: .84rem; }

/* Dialog content for secrets and two-factor setup */
.modal-body { padding: 23px; }
.secret-box { margin-top: 12px; padding: 14px; border: 1px dashed #b9c2cd; border-radius: 8px; background: #f7f8fa; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .95rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.steps { margin: 0 0 8px; padding-left: 20px; color: #414957; font-size: .84rem; }
.steps li { margin: 4px 0; }
.qr-code { width: 200px; height: 200px; margin: 10px auto; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.qr-code svg { display: block; width: 100%; height: 100%; }
.secret-key { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: .78rem; }
.secret-key code { color: var(--ink); font-size: .84rem; letter-spacing: .04em; overflow-wrap: anywhere; }
.button-danger:hover { background: #a03d3d; }

@media (max-width: 860px) {
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .setting-row { display: grid; }
  .row-buttons { justify-content: flex-start; }
  .role-list div { grid-template-columns: 1fr; gap: 2px; }
  .session-item { grid-template-columns: 22px minmax(0, 1fr); }
  .session-item .button { grid-column: 2; justify-self: start; }
  .info-card { padding: 18px 14px; }
}

/* Shared small parts */
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }
td.numeric small { display: block; color: var(--muted); font-size: .68rem; }
.link-button { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 800; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
tr.clickable { cursor: pointer; }
tr.clickable:hover th, tr.clickable:hover td { background: #fafbfc; }
.chip { min-height: 36px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: #414957; font-size: .8rem; font-weight: 700; cursor: pointer; }
.chip:hover { background: #f3f5f7; }
.chip.active { background: var(--navy); border-color: var(--navy); color: white; }
.page-indicator { color: var(--muted); font-size: .76rem; padding: 0 6px; }
.products-tools { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.products-tools .search-control { flex: 1 1 220px; }
.products-tools .search-control input { width: 100%; }
.activity-heading .search-control input[inputmode="numeric"] { width: 130px; }
fieldset.choice-group { margin: 14px 0 0; padding: 0; border: 0; }
fieldset.choice-group legend { margin-bottom: 6px; color: #414957; font-size: .78rem; font-weight: 750; }
.modal fieldset.choice-group label.check-control { display: flex; margin-top: 6px; font-size: .82rem; color: var(--ink); font-weight: 600; }
.modal fieldset.choice-group input { width: 16px; min-height: 0; height: 16px; }
.form-error ul { margin: 6px 0 0; padding-left: 18px; }

/* Product picker (combobox) */
.picker { position: relative; display: grid; gap: 7px; margin-top: 14px; }
.picker > label { color: #414957; font-size: .78rem; font-weight: 750; }
.picker-results { position: absolute; top: 72px; left: 0; right: 0; z-index: 5; max-height: 260px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.picker-results li { display: grid; gap: 1px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.picker-results li strong { font-size: .86rem; }
.picker-results li small { color: var(--muted); font-size: .72rem; }
.picker-results li.active, .picker-results li:hover { background: var(--navy-soft); }
.picker-results .picker-empty { color: var(--muted); cursor: default; }
.picker-selected { margin-top: 0; }

/* Till */
.pos-layout { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.pos-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.pos-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 600; }
.pos-search { flex: 1 1 auto; width: 100%; max-width: 520px; height: 46px; }
.pos-search input { width: 100%; font-size: .92rem; }
.pos-categories { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.pos-product { display: grid; gap: 3px; align-content: start; min-height: 118px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-align: left; cursor: pointer; box-shadow: 0 2px 6px rgba(20, 29, 43, .04); }
.pos-product:hover { border-color: #b8c2cf; box-shadow: var(--shadow); }
.pos-product:active { transform: translateY(1px); }
.pos-product strong { font-size: .9rem; line-height: 1.25; }
.pos-product small { color: var(--muted); font-size: .7rem; }
.pos-price { margin-top: 6px; font-size: 1.05rem; font-weight: 800; }
.pos-stock { color: var(--green); font-size: .72rem; font-weight: 700; }
.pos-stock.low { color: #93620d; }
.pos-stock.out { color: var(--red); }
.pos-product[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.pos-more { display: flex; justify-content: center; padding: 14px 0; }
.pos-cart { position: sticky; top: 92px; display: flex; flex-direction: column; max-height: calc(100vh - 112px); padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.cart-heading { display: flex; align-items: center; justify-content: space-between; }
.cart-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.3rem; }
.cart-heading .text-button { margin: 0; }
.cart-lines { flex: 1 1 auto; margin: 10px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name remove" "qty total"; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--soft-line); }
.cart-line-name { grid-area: name; display: grid; min-width: 0; }
.cart-line-name strong { font-size: .86rem; overflow-wrap: anywhere; }
.cart-line-name small { color: var(--muted); font-size: .7rem; }
.cart-line .row-action { grid-area: remove; width: 30px; height: 30px; }
.cart-line-total { grid-area: total; align-self: center; font-size: .9rem; }
.qty-control { grid-area: qty; display: inline-flex; align-items: center; gap: 4px; }
.qty-control .icon-button { width: 32px; height: 32px; }
.qty-control input { width: 54px; height: 32px; padding: 0 4px; border: 1px solid #ccd2da; border-radius: 6px; text-align: center; font: inherit; font-size: .86rem; }
.cart-empty { display: grid; justify-items: center; gap: 6px; padding: 30px 10px; color: var(--muted); text-align: center; font-size: .84rem; }
.cart-empty svg { width: 28px; height: 28px; }
.cart-empty p { margin: 0; }
.cart-note { display: grid; gap: 5px; margin-top: 10px; color: #414957; font-size: .74rem; font-weight: 750; }
.cart-note input { min-height: 38px; padding: 7px 9px; border: 1px solid #ccd2da; border-radius: 6px; font: inherit; font-size: .84rem; font-weight: 400; }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--ink); }
.cart-total span { font-weight: 800; }
.cart-total strong { font-size: 1.6rem; letter-spacing: -.02em; }
.cart-checkout { width: 100%; min-height: 52px; margin-top: 12px; font-size: 1rem; }
.cart-checkout:disabled { opacity: .5; cursor: not-allowed; }

/* Receipt */
.receipt-modal { width: min(94vw, 420px); }
.receipt { padding: 18px; border: 1px dashed #c4ccd6; border-radius: 8px; background: #fcfcfd; font-size: .84rem; }
.receipt-header { display: grid; gap: 2px; text-align: center; margin-bottom: 10px; }
.receipt-header strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; }
.receipt-header span { color: var(--muted); font-size: .76rem; }
.receipt-meta { display: grid; gap: 2px; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px dashed #c4ccd6; }
.receipt-meta div { display: flex; justify-content: space-between; gap: 10px; }
.receipt-meta dt { color: var(--muted); }
.receipt-meta dd { margin: 0; font-weight: 700; }
.receipt-lines { width: 100%; white-space: normal; }
.receipt-lines td { padding: 6px 0; border: 0; font-size: .84rem; vertical-align: top; }
.receipt-lines td small { display: block; color: var(--muted); font-size: .72rem; }
.receipt-refund td { color: var(--red); }
.receipt-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px dashed #c4ccd6; font-size: 1rem; }
.receipt-void { margin: 0 0 8px; padding: 6px 8px; border-radius: 6px; background: var(--red-soft); color: var(--red); font-weight: 800; text-align: center; }
.receipt-note { margin: 8px 0 0; color: var(--muted); font-size: .76rem; }
.receipt-thanks { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: .76rem; }
#receiptActions { flex-wrap: wrap; }
.refund-lines { margin: 8px 0 0; padding: 0; list-style: none; }
.refund-lines li { padding: 8px 0; border-top: 1px solid var(--soft-line); }
.modal .refund-lines label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.refund-lines label > span { display: grid; }
.refund-lines small { color: var(--muted); font-weight: 400; }
.modal .refund-lines input { width: 80px; text-align: center; }

/* Reports */
.report-controls { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.range-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.range-form { display: flex; align-items: end; gap: 8px; }
.range-form label { display: grid; gap: 4px; color: #414957; font-size: .74rem; font-weight: 750; }
.range-form input { min-height: 38px; padding: 6px 8px; border: 1px solid #ccd2da; border-radius: 6px; font: inherit; font-size: .84rem; }
.report-metrics .metric-card { min-height: 112px; }
.chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: .74rem; }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.legend-sales::before { background: var(--navy); }
.legend-profit::before { background: var(--amber); }
.bar-chart { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; height: 240px; margin-top: 14px; }
.bar-chart > .empty-state { grid-column: 1 / -1; align-self: center; }
.bar-scale { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 20px; color: #8c939c; font-size: .66rem; text-align: right; }
.bar-days { display: grid; grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr)); gap: 4px; align-items: end; border-left: 1px solid var(--soft-line); }
.bar-day { display: grid; grid-template-rows: 1fr 20px; height: 100%; min-width: 0; }
.bar-pair { display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1px solid var(--line); }
.bar { flex: 0 1 14px; min-height: 0; border-radius: 3px 3px 0 0; }
.bar.sales { background: var(--navy); }
.bar.profit { background: var(--amber); }
.bar-day small { overflow: hidden; color: #7d858f; font-size: .62rem; text-align: center; white-space: nowrap; }
.report-grid { max-width: 1220px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.report-grid .table-card { margin: 0; }
.import-summary { margin: 14px 0 8px; font-size: .86rem; }
.import-sample { max-height: 260px; border: 1px solid var(--soft-line); border-radius: 8px; }
#importDialog .file-button { margin-top: 12px; }

@media (max-width: 1100px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { position: static; max-height: none; }
  .pos-heading { display: grid; }
  .pos-search { max-width: none; }
}
@media (max-width: 640px) {
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-controls, .range-form { display: grid; }
  .range-form { grid-template-columns: 1fr 1fr; }
  .range-form .button { grid-column: 1 / -1; }
}

/* Printing: only the receipt, sized for an 80 mm receipt printer or a normal page. */
@media print {
  @page { margin: 8mm; }
  body { background: white; }
  body > *:not(#receiptDialog), .app-shell, .auth-shell, .toast-region, .no-print { display: none !important; }
  #receiptDialog { position: static; display: block; width: auto; max-width: 80mm; margin: 0 auto; padding: 0; border: 0; box-shadow: none; }
  #receiptDialog::backdrop { display: none; }
  #receiptDialog .modal-body { padding: 0; }
  .receipt { border: 0; padding: 0; background: white; font-size: 10pt; color: black; }
}

/* System health (owners) */
.health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.health-item { display: grid; align-content: start; gap: 6px; padding: 12px; border: 1px solid var(--soft-line); border-radius: 8px; background: #fafbfc; }
.health-item .status { justify-self: start; }
.health-item strong { font-size: 1.15rem; }
.health-item small { color: var(--muted); font-size: .76rem; }
.health-item .health-warning { color: #93620d; font-weight: 700; }
@media (max-width: 860px) { .health-grid { grid-template-columns: 1fr; } }
