:root {
  --ink: #213536;
  --muted: #6f817f;
  --line: #e5ded2;
  --paper: #f7f1e6;
  --paper-soft: #fbf8f1;
  --white: #ffffff;
  --sea: #126d73;
  --sea-dark: #164145;
  --sea-soft: #dcefed;
  --lagoon: #72b8b4;
  --sand: #d8c39f;
  --bronze: #9d7953;
  --clay: #c97f62;
  --shadow: 0 22px 58px rgba(33, 53, 54, .11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(220, 239, 237, .7) 0, rgba(247, 241, 230, .9) 420px, var(--paper-soft) 100%);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(340px, 1.05fr);
  background:
    linear-gradient(115deg, rgba(18, 109, 115, .2), transparent 38%),
    linear-gradient(180deg, var(--paper) 0, var(--paper-soft) 100%);
}

.login-brand {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(30px, 5vw, 70px);
  overflow: hidden;
  color: var(--sea-dark);
  background:
    linear-gradient(180deg, rgba(255,255,255,.54), rgba(255,255,255,.1)),
    linear-gradient(140deg, #f4e8d5 0%, #e2d0af 42%, #b8d8d4 73%, #5ea8a9 100%);
}

.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  height: 34%;
  pointer-events: none;
}

.login-brand::before {
  bottom: -12%;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,.52) 0 22%, transparent 23% 100%);
  background-size: 170px 38px;
  opacity: .44;
}

.login-brand::after {
  top: 42%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
}

.brand-lockup,
.brand-display {
  position: relative;
  z-index: 1;
}

.brand-lockup {
  display: grid;
  gap: 14px;
  align-items: start;
}

.brand-logo {
  width: min(360px, 76vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 12px 24px rgba(85, 62, 39, .16));
}

.brand-lockup span,
.topbar-brand span,
.form-head p,
label,
.kpi-card span,
th {
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-lockup span {
  width: fit-content;
  padding: 7px 12px;
  border: 1px solid rgba(157, 121, 83, .28);
  border-radius: 999px;
  color: var(--bronze);
  background: rgba(255,255,255,.48);
  font-size: 11px;
  font-weight: 800;
}

.brand-display {
  padding-bottom: 4vh;
}

.brand-display p {
  margin: 0 0 10px;
  color: var(--bronze);
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 750;
}

.brand-display strong {
  display: block;
  color: var(--white);
  font-size: clamp(58px, 10vw, 132px);
  line-height: .84;
  letter-spacing: 0;
  text-shadow: 0 18px 44px rgba(22, 65, 69, .25);
}

.login-card {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 56px);
}

#login-form {
  width: min(100%, 420px);
  padding: clamp(26px, 4vw, 40px);
  border: 1px solid rgba(157, 121, 83, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.form-head {
  margin-bottom: 28px;
}

.form-head p {
  margin: 0 0 10px;
  color: var(--sea);
  font-size: 11px;
  font-weight: 850;
}

.form-head h1 {
  margin: 0;
  color: var(--sea-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46px;
  font-weight: 500;
  line-height: .95;
  letter-spacing: 0;
}

label {
  display: block;
  color: var(--bronze);
  font-size: 11px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,.9);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(18, 109, 115, .13);
}

#login-form label + label,
#login-form label + .primary-button {
  margin-top: 18px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  border: 0;
  color: var(--white);
  background: linear-gradient(135deg, var(--sea), #4fa8a4);
  box-shadow: 0 10px 22px rgba(18, 109, 115, .18);
}

.primary-button:hover {
  background: linear-gradient(135deg, #0f5f65, #3f9692);
}

.primary-button.compact {
  width: auto;
  min-width: 126px;
  align-self: end;
  padding: 0 18px;
}

.ghost-button {
  padding: 0 14px;
  color: var(--sea-dark);
  border: 1px solid rgba(157, 121, 83, .24);
  background: rgba(255,255,255,.72);
}

.form-error {
  min-height: 22px;
  margin-top: 14px;
  color: var(--clay);
  font-size: 13px;
  font-weight: 750;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(220, 239, 237, .72), rgba(247, 241, 230, .86) 360px, var(--paper-soft) 100%);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 18px;
  border-right: 1px solid rgba(157, 121, 83, .16);
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(18px);
}

.sidebar-brand {
  display: grid;
  gap: 12px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid rgba(157, 121, 83, .14);
}

.sidebar-brand img {
  width: 205px;
  height: auto;
  display: block;
}

.sidebar-brand span {
  width: fit-content;
  padding: 5px 10px;
  border: 1px solid rgba(157, 121, 83, .22);
  border-radius: 999px;
  color: var(--bronze);
  background: rgba(255,255,255,.56);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.app-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 850;
}

.nav-item:hover,
.nav-item.active {
  color: var(--sea-dark);
  border-color: rgba(157, 121, 83, .18);
  background: rgba(255,255,255,.72);
}

.nav-icon {
  position: relative;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--sea);
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.nav-sales::before {
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 13px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 5px 5px;
}

.nav-sales::after {
  left: 5px;
  right: 5px;
  top: 3px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: skewY(-24deg);
}

.nav-reports::before {
  inset: 2px 4px 2px 5px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-reports::after {
  left: 9px;
  bottom: 6px;
  width: 3px;
  height: 8px;
  background: currentColor;
  box-shadow: 5px -4px 0 currentColor;
}

.nav-products::before {
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.nav-products::after {
  left: 8px;
  right: 8px;
  top: 2px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.nav-stores::before {
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.nav-stores::after {
  left: 5px;
  right: 5px;
  top: 3px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 7px solid currentColor;
}

.nav-stock::before {
  inset: 4px 3px 3px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-stock::after {
  left: 7px;
  right: 7px;
  top: 7px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.nav-purchases::before {
  left: 4px;
  right: 4px;
  bottom: 4px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-purchases::after {
  left: 7px;
  right: 7px;
  top: 3px;
  height: 7px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.nav-hr::before {
  left: 8px;
  top: 3px;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.nav-hr::after {
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 999px 999px 4px 4px;
}

.app-main {
  min-width: 0;
}

.mobile-nav {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 38px);
  border-bottom: 1px solid rgba(157, 121, 83, .16);
  background: rgba(251, 248, 241, .88);
  backdrop-filter: blur(18px);
}

.view-subtitle {
  margin: 0 0 4px;
  color: var(--bronze);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  color: var(--sea-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-weight: 500;
  line-height: 1;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-brand img {
  width: clamp(170px, 18vw, 250px);
  height: auto;
  display: block;
}

.topbar-brand span {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-left: 1px solid rgba(157, 121, 83, .28);
  color: var(--bronze);
  font-size: 11px;
  font-weight: 850;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-area span {
  max-width: 220px;
  overflow: hidden;
  color: var(--sea-dark);
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 34px) 42px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(157, 121, 83, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.64);
}

.range-presets {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preset-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(157, 121, 83, .14);
  border-radius: 8px;
  background: rgba(255,255,255,.58);
}

.preset-group span {
  flex: 0 0 auto;
  min-width: 34px;
  color: var(--bronze);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.preset-button {
  min-width: 34px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(18, 109, 115, .16);
  border-radius: 8px;
  color: var(--sea-dark);
  background: rgba(220, 239, 237, .42);
  font-size: 12px;
  font-weight: 850;
}

.preset-button:hover,
.preset-button.active {
  color: var(--white);
  border-color: var(--sea);
  background: var(--sea);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-card,
.panel {
  border: 1px solid rgba(157, 121, 83, .17);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 16px 36px rgba(33, 53, 54, .06);
}

.kpi-card {
  min-height: 116px;
  padding: 18px;
  border-top: 3px solid var(--sea);
}

.kpi-card:nth-child(2) {
  border-top-color: var(--lagoon);
}

.kpi-card:nth-child(3) {
  border-top-color: var(--bronze);
}

.kpi-card.accent {
  border-top-color: var(--clay);
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.kpi-card strong {
  display: block;
  margin-top: 12px;
  color: var(--sea-dark);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .95fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(157, 121, 83, .14);
  background: rgba(255,255,255,.44);
}

.panel-head h2 {
  margin: 0;
  color: var(--sea-dark);
  font-size: 16px;
  letter-spacing: 0;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.sales-chart {
  min-height: 320px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(26px, 1fr);
  align-items: end;
  gap: 8px;
  padding: 20px 16px 18px;
}

.bar {
  min-width: 0;
  display: grid;
  align-items: end;
  gap: 8px;
}

.bar-fill {
  min-height: 6px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--lagoon), var(--sea));
}

.bar:nth-child(4n) .bar-fill {
  background: linear-gradient(180deg, #ecd9b7, var(--bronze));
}

.bar:nth-child(5n) .bar-fill {
  background: linear-gradient(180deg, #efb49a, var(--clay));
}

.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(157, 121, 83, .13);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--bronze);
  background: rgba(247, 241, 230, .66);
  font-size: 11px;
  font-weight: 900;
}

td {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

td strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.strong-num {
  color: var(--sea-dark);
  font-weight: 900;
}

.product-cell {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-cell span {
  min-width: 0;
}

.product-thumb-button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.product-thumb-button:focus-visible {
  outline: 3px solid rgba(18, 109, 115, .22);
  outline-offset: 2px;
}

.product-thumb-button:hover .product-thumb {
  border-color: rgba(18, 109, 115, .45);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(33, 53, 54, .13);
}

.product-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: block;
  border: 1px solid rgba(157, 121, 83, .18);
  border-radius: 8px;
  background: var(--paper);
  object-fit: cover;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}

.product-thumb.empty {
  position: relative;
  background: linear-gradient(140deg, var(--paper), var(--sea-soft));
}

.product-thumb.empty::after {
  content: "";
  position: absolute;
  inset: 13px 10px;
  border-top: 2px solid rgba(18, 109, 115, .5);
  border-bottom: 2px solid rgba(157, 121, 83, .5);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.status-pill.ok {
  color: var(--sea-dark);
  background: var(--sea-soft);
}

.status-pill.off {
  color: #7d4b3d;
  background: #f5dfd5;
}

.reason-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 190px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--sea-dark);
  background: var(--sea-soft);
  font-size: 11px;
  font-weight: 900;
  white-space: normal;
}

.icon-action {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(18, 109, 115, .18);
  border-radius: 8px;
  color: var(--white);
  background: var(--sea);
  font-size: 18px;
  font-weight: 900;
}

.muted-action {
  color: var(--sea-dark);
  background: rgba(220, 239, 237, .5);
}

.purchases-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, .8fr);
}

.basket-panel {
  align-self: start;
}

.scan-box {
  padding: 14px 16px 4px;
}

.basket-table {
  max-height: 430px;
}

.basket-actions {
  display: flex;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(157, 121, 83, .13);
}

.basket-actions .primary-button,
.basket-actions .ghost-button {
  flex: 1;
}

.qty-stepper {
  display: inline-grid;
  grid-template-columns: 30px 34px 30px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(157, 121, 83, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.74);
}

.qty-stepper button {
  width: 30px;
  height: 30px;
  border: 0;
  color: var(--sea);
  background: transparent;
  font-weight: 900;
}

.qty-stepper strong {
  display: grid;
  place-items: center;
  height: 30px;
  border-left: 1px solid rgba(157, 121, 83, .14);
  border-right: 1px solid rgba(157, 121, 83, .14);
  font-size: 12px;
}

.rank-list {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.rank-row {
  display: grid;
  gap: 7px;
  padding-bottom: 2px;
}

.rank-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.rank-toggle span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--sea-dark);
  background: var(--sea-soft);
  font-size: 11px;
  font-weight: 900;
}

.rank-toggle strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
}

.rank-toggle em {
  display: grid;
  gap: 2px;
  color: var(--sea-dark);
  text-align: right;
  font-style: normal;
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.rank-toggle em small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rank-toggle em span {
  white-space: nowrap;
}

.rank-margin {
  color: var(--bronze);
}

.rank-toggle b {
  min-width: 56px;
  padding: 5px 9px;
  border: 1px solid rgba(18, 109, 115, .18);
  border-radius: 999px;
  color: var(--sea);
  background: rgba(220, 239, 237, .54);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.rank-toggle:hover b,
.rank-row.open .rank-toggle b {
  color: var(--white);
  background: var(--sea);
}

.rank-meta {
  margin-left: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.rank-track {
  height: 7px;
  margin-left: 38px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 109, 115, .1);
}

.rank-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sea), var(--lagoon));
}

.category-products {
  margin: 8px 0 2px 38px;
  overflow: hidden;
  border: 1px solid rgba(157, 121, 83, .13);
  border-radius: 8px;
  background: rgba(255,255,255,.58);
}

.compact-table {
  max-height: 470px;
}

.text-button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  color: var(--sea);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
}

.text-button:hover {
  color: var(--sea-dark);
  background: rgba(220, 239, 237, .42);
}

.category-more {
  width: 100%;
  border-top: 1px solid rgba(157, 121, 83, .12);
}

.empty-state.compact {
  min-height: auto;
  padding: 16px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 14px;
  padding: 68px 22px 28px;
  background: rgba(22, 65, 69, .74);
  backdrop-filter: blur(12px);
}

.image-viewer[hidden] {
  display: none !important;
}

.image-viewer img {
  max-width: min(92vw, 960px);
  max-height: 78vh;
  display: block;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(10, 24, 25, .34);
  object-fit: contain;
}

.image-viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 8px;
  color: var(--white);
  background: rgba(255,255,255,.14);
  font-size: 13px;
  font-weight: 850;
  backdrop-filter: blur(12px);
}

.image-viewer-close:hover {
  background: rgba(255,255,255,.22);
}

.image-viewer-caption {
  max-width: min(92vw, 760px);
  color: var(--white);
  text-align: center;
  font-size: 14px;
  font-weight: 750;
  text-shadow: 0 2px 12px rgba(10, 24, 25, .38);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--white);
  background: var(--sea-dark);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  font-size: 14px;
  font-weight: 750;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-view {
    display: block;
    padding-bottom: 76px;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    min-height: 62px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(157, 121, 83, .18);
    border-radius: 8px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 18px 48px rgba(33, 53, 54, .18);
    backdrop-filter: blur(18px);
  }

  .mobile-nav .nav-item {
    min-height: 50px;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    padding: 4px 2px;
    font-size: 10px;
  }

  .mobile-nav .nav-icon {
    width: 21px;
    height: 21px;
  }

  .login-view {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 330px;
  }

  .login-card {
    min-height: auto;
  }

  .toolbar,
  .kpi-grid,
  .main-grid,
  .purchases-grid {
    grid-template-columns: 1fr;
  }

  .range-presets {
    grid-template-columns: 1fr;
  }

  .primary-button.compact {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .login-brand {
    padding: 24px;
  }

  .brand-logo {
    width: min(300px, 82vw);
  }

  .login-card {
    padding: 18px;
  }

  #login-form {
    padding: 24px;
  }

  .topbar {
    min-height: 68px;
    align-items: flex-start;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .topbar-brand {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-brand img {
    width: min(220px, 62vw);
  }

  .user-area {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    padding-top: 14px;
  }

  .preset-group {
    overflow-x: auto;
  }

  .preset-button {
    flex: 0 0 auto;
  }

  .rank-toggle {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }

  .rank-toggle strong {
    grid-column: 2 / -1;
  }

  .rank-toggle em {
    text-align: right;
  }

  .rank-sales {
    grid-column: 2;
  }

  .rank-margin {
    grid-column: 3;
  }

  .rank-toggle b {
    grid-column: 2 / -1;
    width: fit-content;
  }

  .category-products {
    margin-left: 0;
  }

  .image-viewer {
    padding: 62px 12px 22px;
  }

  .image-viewer img {
    max-width: 94vw;
    max-height: 72vh;
  }

  .image-viewer-close {
    top: 12px;
    right: 12px;
  }
}
