:root {
  --bg: #080808;
  --bg-elevated: #101010;
  --panel: #141414;
  --panel-soft: #191919;
  --panel-hover: #1e1e1e;
  --gold: #d4af37;
  --gold-light: #f0d678;
  --gold-dark: #9f7d1d;
  --gold-faint: rgba(212, 175, 55, 0.12);
  --text: #f5f2e9;
  --text-soft: #c7c2b6;
  --muted: #8e8a80;
  --border: #2c2a25;
  --border-gold: rgba(212, 175, 55, 0.32);
  --danger: #ff7d7d;
  --danger-bg: rgba(255, 80, 80, 0.12);
  --success: #8ed6a4;
  --success-bg: rgba(67, 180, 104, 0.13);
  --warning: #f5c760;
  --warning-bg: rgba(245, 178, 42, 0.13);
  --info: #8cbcf2;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: 264px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 0%, rgba(212, 175, 55, 0.06), transparent 26rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -0.02em; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 2vw, 1.75rem); }
h2 { margin-bottom: 0; font-size: clamp(1.2rem, 2vw, 1.55rem); }
h3 { margin-bottom: 0.25rem; font-size: 1rem; }

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-shell { display: flex; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(12, 12, 12, 0.98);
  box-shadow: 14px 0 40px rgba(0, 0, 0, 0.18);
}
.brand {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 0.9rem;
  padding: 1.25rem 1.3rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
  background: linear-gradient(145deg, rgba(212,175,55,.18), rgba(212,175,55,.03));
  box-shadow: inset 0 0 0 4px #101010, 0 0 24px rgba(212,175,55,.08);
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
}
.brand-mark-large { width: 68px; height: 68px; font-size: 1.4rem; }
.brand-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-family: Georgia, serif; font-size: 1.1rem; font-weight: 600; white-space: nowrap; }
.brand-copy small { margin-top: 0.2rem; color: var(--gold); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.brand-logo-link { min-height: 118px; justify-content: center; padding: .65rem .9rem; background: #050505; }
.brand-logo-sidebar { display: block; width: 100%; max-width: 224px; max-height: 104px; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(212,175,55,.08)); }

.nav-list { display: flex; flex: 1; flex-direction: column; gap: 0.25rem; padding: 1.15rem 0.85rem; overflow-y: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.72rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 650;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-link:hover { color: var(--text); background: var(--panel-soft); }
.nav-link.active { border-color: var(--border-gold); color: var(--gold-light); background: var(--gold-faint); }
.nav-icon { display: inline-grid; width: 1.35rem; height: 1.35rem; place-items: center; color: var(--gold); font-size: 1rem; }

.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; padding: 0.6rem; border-radius: var(--radius-sm); background: var(--panel); }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #0b0b0b; background: var(--gold); font-weight: 900; }
.user-card-copy { display: flex; min-width: 0; flex-direction: column; }
.user-card-copy strong { overflow: hidden; font-size: 0.83rem; text-overflow: ellipsis; white-space: nowrap; }
.user-card-copy small { color: var(--muted); font-size: 0.72rem; }
.sidebar-action { display: block; width: 100%; padding: 0.42rem 0.65rem; color: var(--muted); font-size: 0.77rem; text-align: left; }
.sidebar-action:hover { color: var(--gold-light); }
.button-reset { border: 0; background: transparent; cursor: pointer; }

.app-content { width: calc(100% - var(--sidebar-width)); min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 8, 0.88);
  backdrop-filter: blur(18px);
}
.topbar > div { min-width: 0; }
.topbar-action { margin-left: auto; }
.menu-button { display: none !important; }
.main-content { width: min(1600px, 100%); min-height: calc(100vh - 146px); margin: 0 auto; padding: clamp(1rem, 2.6vw, 2rem); }
.app-footer { padding: 0 2rem 1.25rem; color: var(--muted); font-size: 0.72rem; text-align: center; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.64rem 1rem;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, border-color .16s ease, background .16s ease, color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.button-primary { color: #0a0a0a; background: linear-gradient(135deg, var(--gold-light), var(--gold)); box-shadow: 0 8px 22px rgba(212,175,55,.12); }
.button-primary:hover { background: var(--gold-light); }
.button-secondary { border-color: var(--border-gold); color: var(--gold-light); background: var(--gold-faint); }
.button-secondary:hover { border-color: var(--gold); background: rgba(212,175,55,.18); }
.button-outline { border-color: var(--border); color: var(--text-soft); background: transparent; }
.button-outline:hover { border-color: var(--gold-dark); color: var(--gold-light); }
.button-ghost { border-color: transparent; color: var(--text-soft); background: var(--panel-soft); }
.button-ghost:hover { color: var(--text); background: var(--panel-hover); }
.button-small { min-height: 32px; padding: 0.42rem 0.68rem; font-size: 0.74rem; }
.button-block { width: 100%; }
.icon-button { display: inline-grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: var(--panel); cursor: pointer; }
.text-link { color: var(--gold); font-size: 0.82rem; font-weight: 800; }
.text-link:hover { color: var(--gold-light); }

.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(22,22,22,.98), rgba(15,15,15,.98));
  box-shadow: var(--shadow);
}
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--border); }
.panel-header-wrap { flex-wrap: wrap; align-items: center; }
.panel-subtitle { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.82rem; }
.content-narrow { width: min(680px, 100%); margin: 0 auto; }
.content-wide { width: min(980px, 100%); margin: 0 auto; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card {
  display: flex;
  min-height: 116px;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel-soft), #111);
  box-shadow: 0 12px 34px rgba(0,0,0,.24);
}
.stat-icon { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border-gold); border-radius: 12px; color: var(--gold-light); background: var(--gold-faint); font-family: Georgia, serif; font-size: 1.15rem; font-weight: 800; }
.stat-card > div { min-width: 0; }
.stat-label { display: block; margin-bottom: 0.3rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.stat-card strong { display: block; overflow: hidden; font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.stat-warning { border-color: rgba(245,199,96,.32); }
.stat-warning .stat-icon { border-color: rgba(245,199,96,.42); color: var(--warning); background: var(--warning-bg); }
.stat-danger { border-color: rgba(255,125,125,.32); }
.stat-danger .stat-icon { border-color: rgba(255,125,125,.4); color: var(--danger); background: var(--danger-bg); }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.quick-action { display: grid; grid-template-columns: 40px 1fr; gap: 0 .8rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); transition: border-color .16s ease, transform .16s ease, background .16s ease; }
.quick-action:hover { transform: translateY(-2px); border-color: var(--border-gold); background: var(--panel-soft); }
.quick-action > span { grid-row: 1 / span 2; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; color: var(--gold-light); background: var(--gold-faint); font-size: 1.1rem; }
.quick-action strong { font-size: .88rem; }
.quick-action small { color: var(--muted); font-size: .72rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 1rem; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { padding: 0.76rem 1rem; color: var(--muted); background: rgba(255,255,255,.015); font-size: 0.68rem; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 0.88rem 1rem; border-top: 1px solid var(--border); color: var(--text-soft); vertical-align: middle; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.table-primary { display: block; color: var(--text); font-weight: 750; }
a.table-primary:hover { color: var(--gold-light); }
.table-secondary { display: block; max-width: 340px; margin-top: .18rem; overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.align-right { text-align: right; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; white-space: nowrap; }
.row-actions form { margin: 0; }
.stock-number { color: var(--success); font-weight: 800; white-space: nowrap; }
.stock-low { color: var(--warning); }
.stock-zero { color: var(--danger); }
.movement-quantity { color: var(--success); font-weight: 800; white-space: nowrap; }
.movement-quantity.negative, .activity-value.negative { color: var(--danger); }

.badge { display: inline-flex; align-items: center; justify-content: center; padding: .28rem .52rem; border: 1px solid transparent; border-radius: 99px; font-size: .65rem; font-weight: 850; line-height: 1; white-space: nowrap; }
.badge-success { border-color: rgba(142,214,164,.25); color: var(--success); background: var(--success-bg); }
.badge-warning { border-color: rgba(245,199,96,.27); color: var(--warning); background: var(--warning-bg); }
.badge-danger { border-color: rgba(255,125,125,.27); color: var(--danger); background: var(--danger-bg); }
.badge-muted { border-color: var(--border); color: var(--muted); background: rgba(255,255,255,.03); }
.badge-movement { border-color: var(--border-gold); color: var(--gold-light); background: var(--gold-faint); }
.badge-usage, .badge-wastage, .badge-adjustment_remove, .badge-return_supplier { border-color: rgba(255,125,125,.22); color: #f2a5a5; background: rgba(255,80,80,.09); }
.badge-opening, .badge-stock_in, .badge-adjustment_add { border-color: rgba(142,214,164,.22); color: var(--success); background: var(--success-bg); }
.badge-admin { color: var(--gold-light); background: var(--gold-faint); border-color: var(--border-gold); }
.badge-manager { color: var(--info); background: rgba(80,140,220,.12); border-color: rgba(140,188,242,.25); }
.badge-staff { color: var(--text-soft); background: rgba(255,255,255,.04); border-color: var(--border); }
.badge-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.you-tag { padding: .12rem .3rem; border-radius: 4px; color: #111; background: var(--gold); font-size: .58rem; vertical-align: middle; }

.filter-bar { display: flex; align-items: flex-end; gap: .65rem; padding: 1rem 1.35rem; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.012); }
.filter-bar > div { min-width: 140px; }
.filter-bar .filter-grow { min-width: 190px; flex: 1; }
.filter-bar label { display: block; margin: 0 0 .32rem; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.filter-bar input, .filter-bar select { width: 100%; min-height: 40px; padding: .58rem .72rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: #101010; }
.filter-button { min-height: 40px; }

.form-stack { padding: 1.35rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-group { min-width: 0; margin-bottom: 1rem; }
.form-grid .form-group { margin-bottom: 0; }
.form-label { display: block; margin-bottom: .42rem; color: var(--text-soft); font-size: .78rem; font-weight: 750; }
.form-control {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: .68rem .78rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  background: #0d0d0d;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.form-control { min-height: 110px; resize: vertical; }
.form-control:hover { border-color: #403c33; }
.form-control:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.1); outline: none; }
.form-control::placeholder { color: #5e5b54; }
select.form-control { cursor: pointer; }
.form-help { margin-top: .35rem; color: var(--muted); font-size: .7rem; }
.form-error { margin-top: .3rem; color: var(--danger); font-size: .72rem; font-weight: 650; }
.has-error .form-control { border-color: rgba(255,125,125,.7); }
.checkbox-row { display: inline-flex; align-items: center; gap: .55rem; color: var(--text-soft); font-size: .8rem; cursor: pointer; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--gold); }
.form-section { margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.015); }
.form-section-title { margin-bottom: 1rem; }
.form-section-title p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.hidden-field { display: none; }

.flash-stack { display: grid; gap: .55rem; margin-bottom: 1rem; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .78rem .9rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text-soft); background: var(--panel); box-shadow: 0 10px 28px rgba(0,0,0,.2); font-size: .8rem; }
.flash-success { border-color: rgba(142,214,164,.3); background: var(--success-bg); }
.flash-danger { border-color: rgba(255,125,125,.3); background: var(--danger-bg); }
.flash-warning { border-color: rgba(245,199,96,.3); background: var(--warning-bg); }
.flash-info { border-color: rgba(140,188,242,.27); background: rgba(80,140,220,.1); }
.flash-close { border: 0; color: var(--muted); background: transparent; font-size: 1.15rem; cursor: pointer; }

.empty-state { display: flex; min-height: 220px; align-items: center; justify-content: center; flex-direction: column; padding: 2rem; text-align: center; }
.empty-state > span { display: grid; width: 48px; height: 48px; margin-bottom: .85rem; place-items: center; border: 1px solid var(--border-gold); border-radius: 50%; color: var(--gold); background: var(--gold-faint); font-size: 1.2rem; }
.empty-state h3 { margin-bottom: .25rem; }
.empty-state p { max-width: 430px; margin-bottom: 1rem; color: var(--muted); font-size: .8rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: .8rem; padding: 1rem; border-top: 1px solid var(--border); }
.page-link { padding: .42rem .72rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text-soft); font-size: .74rem; font-weight: 750; }
.page-link:hover { border-color: var(--gold-dark); color: var(--gold-light); }
.page-link.disabled { opacity: .35; pointer-events: none; }
.page-status { color: var(--muted); font-size: .7rem; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: .75rem; padding: .88rem 1.2rem; border-top: 1px solid var(--border); }
.activity-item:first-child { border-top: 0; }
.activity-item:hover { background: rgba(255,255,255,.018); }
.movement-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-faint); }
.movement-dot-usage, .movement-dot-wastage, .movement-dot-adjustment_remove, .movement-dot-return_supplier { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.movement-dot-opening, .movement-dot-stock_in, .movement-dot-adjustment_add { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.activity-copy { display: flex; min-width: 0; flex-direction: column; }
.activity-copy strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small, .activity-value small { color: var(--muted); font-size: .66rem; }
.activity-value { display: flex; align-items: flex-end; flex-direction: column; color: var(--success); font-size: .78rem; font-weight: 800; white-space: nowrap; }

.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: .35rem 0; }
.detail-title-row { display: flex; align-items: center; gap: 1rem; }
.product-monogram, .summary-monogram { display: grid; width: 58px; height: 58px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border-gold); border-radius: 15px; color: var(--gold-light); background: linear-gradient(145deg, var(--gold-faint), transparent); font-family: Georgia, serif; font-size: 1.1rem; font-weight: 700; }
.heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.stat-grid-detail { margin-bottom: 1rem; }
.detail-grid { display: grid; grid-template-columns: minmax(270px, .36fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.detail-list { margin: 0; padding: .55rem 1.35rem 1rem; }
.detail-list div { display: grid; grid-template-columns: minmax(110px, .9fr) 1.1fr; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .72rem; }
.detail-list dd { margin: 0; color: var(--text); font-size: .78rem; font-weight: 700; text-align: right; }
.detail-list.compact { padding: .5rem 0; }
.notes-box { margin: 0 1.35rem 1rem; padding: .9rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.018); }
.notes-box strong { color: var(--gold-light); font-size: .72rem; }
.notes-box p { margin: .35rem 0 0; color: var(--text-soft); font-size: .78rem; white-space: pre-line; }
.detail-grid > .panel:first-child > form { padding: 0 1.35rem 1.2rem; }

.movement-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1rem; align-items: start; width: min(1050px, 100%); margin: 0 auto; }
.movement-summary { position: sticky; top: 110px; padding: 1.35rem; }
.movement-summary h2 { margin-top: .8rem; }
.summary-monogram { margin-top: .8rem; }
.notice-box { margin-top: .9rem; padding: .8rem; border: 1px solid var(--border-gold); border-radius: 10px; background: var(--gold-faint); }
.notice-box strong { color: var(--gold-light); font-size: .74rem; }
.notice-box p { margin: .3rem 0 0; color: var(--text-soft); font-size: .7rem; }
.notice-warning { border-color: rgba(245,199,96,.25); background: var(--warning-bg); }
.notice-warning strong { color: var(--warning); }

.card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: 1rem; }
.list-card { display: flex; align-items: center; gap: .85rem; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.014); }
.list-card-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--gold); background: var(--gold-faint); }
.list-card-copy { min-width: 0; flex: 1; }
.list-card-copy h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card-copy p { margin: 0; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.list-card-copy small { color: var(--gold-dark); font-size: .65rem; }

.report-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 1rem; }
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: .7rem; padding: .8rem 1.2rem; border-top: 1px solid var(--border); }
.rank-item:first-child { border-top: 0; }
.rank-number { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; color: var(--gold); background: var(--gold-faint); font-size: .7rem; font-weight: 900; }
.rank-copy { display: flex; min-width: 0; flex-direction: column; }
.rank-copy strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.rank-copy small { color: var(--muted); font-size: .68rem; }
.rank-item > strong { color: var(--gold-light); font-size: .82rem; }
.report-highlight { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; padding: 1.5rem; border-color: var(--border-gold); background: radial-gradient(circle at 100% 0, rgba(212,175,55,.13), transparent 65%), var(--panel); }
.report-highlight p:not(.eyebrow) { color: var(--text-soft); font-size: .78rem; }
.hero-value { display: block; margin: .6rem 0 .75rem; color: var(--gold-light); font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; line-height: 1; }

.error-page { display: flex; min-height: 65vh; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.error-page > span { color: var(--gold); font-family: Georgia, serif; font-size: clamp(4rem, 12vw, 8rem); line-height: 1; opacity: .45; }
.error-page h2 { margin-top: .8rem; }
.error-page p { max-width: 450px; margin: .5rem 0 1.2rem; color: var(--muted); }

.auth-shell { display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(circle at 20% 20%, rgba(212,175,55,.09), transparent 30rem), radial-gradient(circle at 90% 90%, rgba(212,175,55,.05), transparent 24rem), #070707; }
.auth-content { width: min(980px, 100%); }
.login-panel { display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid var(--border); border-radius: 24px; background: #0e0e0e; box-shadow: 0 35px 100px rgba(0,0,0,.55); }
.login-brand { display: flex; min-height: 590px; justify-content: center; flex-direction: column; padding: clamp(2rem, 6vw, 4.5rem); border-right: 1px solid var(--border); background: radial-gradient(circle at 20% 10%, rgba(212,175,55,.16), transparent 20rem), linear-gradient(145deg, #15130f, #090909 70%); }
.login-brand .brand-mark { margin-bottom: 2rem; }
.login-logo { display: block; width: min(440px, 100%); height: auto; margin: 0 0 1.7rem; object-fit: contain; filter: drop-shadow(0 18px 40px rgba(212,175,55,.12)); }
.login-logo-mobile { display: none; width: min(300px, 100%); height: auto; margin: 0 auto 1.35rem; object-fit: contain; }
.login-brand h1 { margin: .35rem 0 1rem; font-family: Georgia, serif; font-size: clamp(2.35rem, 5vw, 3.8rem); font-weight: 500; line-height: 1; }
.login-brand h1 span { color: var(--gold-light); }
.login-brand > p:last-child { max-width: 430px; color: var(--text-soft); font-size: .92rem; }
.login-card { display: flex; justify-content: center; flex-direction: column; padding: clamp(1.6rem, 5vw, 3rem); }
.login-card-header { margin-bottom: 1.4rem; }
.login-card-header h2 { margin-bottom: .3rem; font-size: 1.8rem; }
.login-card-header > p:last-child { margin: 0; color: var(--muted); font-size: .82rem; }
.login-card form { padding: 0; }
.auth-content > .flash-stack { width: min(500px, 100%); margin: 0 auto 1rem; }

.sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .movement-layout { grid-template-columns: minmax(0, 1fr) 290px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar > div { flex: 1 1 170px; }
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; display: block; visibility: hidden; background: rgba(0,0,0,.62); opacity: 0; transition: opacity .22s ease, visibility .22s ease; }
  body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .app-content { width: 100%; margin-left: 0; }
  .menu-button { display: inline-grid !important; }
  .movement-layout { grid-template-columns: 1fr; }
  .movement-summary { position: static; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-movements { grid-row: 1; }
  .login-panel { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 2.5rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .login-brand h1 { font-size: 3rem; }
  .login-brand > p:last-child { margin-bottom: 0; }
}

@media (max-width: 720px) {
  .main-content { padding: .8rem; }
  .topbar { min-height: 76px; padding: .8rem; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 1.2rem; }
  .topbar-action { width: 42px; min-width: 42px; padding: 0; overflow: hidden; color: transparent; }
  .topbar-action::before { content: '+'; color: #0a0a0a; font-size: 1.2rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat-card { min-height: 100px; padding: .85rem; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-card strong { font-size: 1rem; }
  .quick-actions { grid-template-columns: 1fr; gap: .65rem; }
  .panel-header { padding: 1rem; }
  .filter-bar { padding: .8rem 1rem; }
  .filter-bar > div, .filter-bar .filter-grow { min-width: 100%; flex-basis: 100%; }
  .filter-button { flex: 1; }
  .form-stack { padding: 1rem; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .product-monogram { width: 48px; height: 48px; }
  .card-list { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
  .activity-item { padding: .78rem 1rem; }
  .login-brand { display: none; }
  .login-logo-mobile { display: block; }
  .login-card { min-height: 520px; padding: 1.4rem; }
  .login-panel { border-radius: 18px; }
  .auth-shell { padding: .7rem; }
  .row-actions { align-items: flex-end; flex-direction: column; }
  th, td { padding: .75rem .8rem; }
}

@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 88px; }
  .detail-title-row { align-items: flex-start; }
  .heading-actions { flex-direction: column; }
  .heading-actions .button { width: 100%; }
}

@media print {
  :root { --text: #111; --text-soft: #333; --muted: #666; --border: #ddd; }
  body { color: #111; background: #fff; }
  .sidebar, .topbar, .app-footer, .button, .filter-bar, .flash-stack { display: none !important; }
  .app-content { width: 100%; margin: 0; }
  .main-content { padding: 0; }
  .panel, .stat-card { break-inside: avoid; border-color: #ddd; color: #111; background: #fff; box-shadow: none; }
  th { color: #333; background: #f2f2f2; }
  td { color: #222; }
}

/* Red blinking dashboard alarm for Low Stock / Out of Stock cards */
.stat-card-link { color: inherit; }
.stat-card-link small { display: block; margin-top: .25rem; color: var(--muted); font-size: .68rem; font-weight: 700; }
.stat-alarm {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 75, 75, .85) !important;
  box-shadow: 0 0 0 1px rgba(255,75,75,.28), 0 0 24px rgba(255,75,75,.24), 0 12px 34px rgba(0,0,0,.32);
  animation: alarmBlink 1s infinite;
}
.stat-alarm .stat-icon {
  color: #fff;
  border-color: rgba(255,255,255,.65);
  background: rgba(255, 0, 0, .35);
}
@keyframes alarmBlink {
  0%, 100% { background: linear-gradient(145deg, rgba(80,0,0,.94), rgba(22,0,0,.96)); }
  50% { background: linear-gradient(145deg, rgba(210,0,0,.88), rgba(80,0,0,.96)); }
}

/* v1.2 finance, reporting and installable mobile app */
[hidden] { display: none !important; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-left: auto; }
.topbar-action { margin-left: 0; white-space: nowrap; }
.topbar-action > span { font-size: 1rem; font-weight: 900; }
.button-expense { border-color: rgba(240,214,120,.7); color: #080808; background: linear-gradient(135deg, #ffe79a, #d4af37); box-shadow: 0 8px 22px rgba(212,175,55,.14); }
.button-expense:hover { background: #ffe79a; }
.button-install { border-color: var(--border-gold); color: var(--gold-light); background: #17140b; }
.button-danger { border-color: rgba(255,125,125,.32); color: var(--danger); background: var(--danger-bg); }
.button:disabled, .button.is-loading { opacity: .58; cursor: wait; transform: none; }
.badge-accountant { color: #c7b4ff; background: rgba(137,92,246,.12); border-color: rgba(199,180,255,.28); }
.stat-success { border-color: rgba(142,214,164,.3); }
.stat-success .stat-icon { border-color: rgba(142,214,164,.35); color: var(--success); background: var(--success-bg); }
.stat-expense { border-color: rgba(240,214,120,.42); background: radial-gradient(circle at 100% 0, rgba(212,175,55,.15), transparent 55%), var(--panel-soft); }
.stat-card small { display: block; margin-top: .3rem; color: var(--muted); font-size: .68rem; font-weight: 650; }
.stat-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
.quick-actions { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.quick-action-expense { border-color: var(--border-gold); background: linear-gradient(145deg, rgba(212,175,55,.12), var(--panel)); }
.expense-value { color: var(--gold-light); white-space: nowrap; }
.investment-value { color: var(--success); white-space: nowrap; }
.selected-movement-type { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; padding: .8rem; border: 1px solid var(--border-gold); border-radius: 11px; background: var(--gold-faint); }
.selected-movement-type > span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: #090909; background: var(--gold); font-size: 1.2rem; font-weight: 900; }
.selected-movement-type div { display: flex; flex-direction: column; }
.selected-movement-type small { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.selected-movement-type strong { color: var(--gold-light); font-size: .88rem; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 1.35rem 0 .7rem; }
.section-heading > span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.period-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; padding: 1rem 1.35rem 0; }
.period-button { display: flex; align-items: flex-start; flex-direction: column; min-height: 70px; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-soft); }
.period-button:hover, .period-button.active { border-color: var(--gold); background: var(--gold-faint); }
.period-button span { color: var(--gold-light); font-size: .76rem; font-weight: 850; }
.period-button strong { margin-top: .18rem; color: var(--muted); font-size: .66rem; font-weight: 650; }
.period-value { font-size: 1.05rem !important; }
.counter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.counter-card { display: flex; min-height: 106px; align-items: center; gap: .85rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, var(--panel-soft), #111); box-shadow: 0 12px 34px rgba(0,0,0,.22); }
.counter-card:hover, .counter-card.active { transform: translateY(-1px); border-color: var(--gold); background: var(--gold-faint); }
.counter-card > span { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border-gold); border-radius: 50%; color: var(--gold-light); background: var(--gold-faint); font-family: Georgia, serif; font-weight: 800; }
.counter-card > div { display: flex; min-width: 0; flex-direction: column; }
.counter-card small { overflow: hidden; color: var(--muted); font-size: .68rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.counter-card strong { margin: .18rem 0; color: var(--text); font-size: 1.05rem; }
.counter-card em { color: var(--gold-dark); font-size: .65rem; font-style: normal; font-weight: 750; }
.report-grid-finance { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
.report-negative { border-color: rgba(255,125,125,.35); }
.report-negative .hero-value { color: var(--danger); }

.mobile-action-dock { display: none; }
.install-modal { position: fixed; inset: 0; z-index: 100; place-items: center; padding: 1rem; background: rgba(0,0,0,.78); backdrop-filter: blur(8px); }
.install-modal:not([hidden]) { display: grid; }
.install-modal-card { position: relative; width: min(390px, 100%); padding: 1.5rem; border: 1px solid var(--border-gold); border-radius: 20px; background: linear-gradient(155deg, #1a1812, #0d0d0d); box-shadow: 0 30px 90px rgba(0,0,0,.65); text-align: center; }
.install-modal-card .brand-mark { margin: 0 auto 1rem; }
.install-modal-logo { display: block; width: min(245px, 78%); height: auto; margin: 0 auto 1rem; object-fit: contain; filter: drop-shadow(0 10px 28px rgba(212,175,55,.12)); }
.install-modal-card p { color: var(--text-soft); font-size: .82rem; }
.install-modal-close { position: absolute; top: .7rem; right: .7rem; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--text-soft); background: var(--panel-soft); font-size: 1.3rem; cursor: pointer; }
body.modal-open { overflow: hidden; }
.offline-panel { min-height: 0; }

input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
.finance-entry-form .form-control { min-height: 48px; }
.header-actions { display: flex; flex-wrap: wrap; gap: .65rem; }

@media (max-width: 1180px) {
  .counter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions { max-width: 64%; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
}

@media (max-width: 720px) {
  body.app-shell { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .main-content { padding-bottom: 1rem; }
  .app-footer { padding-bottom: .5rem; }
  .topbar { min-height: 70px; gap: .45rem; padding: .65rem .7rem; }
  .topbar-title { flex: 1 1 auto; overflow: hidden; }
  .topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex: 0 0 auto; max-width: 49vw; gap: .3rem; overflow-x: auto; }
  .topbar-action { width: 42px; min-width: 42px; height: 42px; min-height: 42px; padding: 0; overflow: visible; color: inherit; }
  .topbar-action::before { content: none !important; }
  .topbar-action b { display: none; }
  .topbar-action > span { display: block; color: currentColor; font-size: 1rem; }
  .topbar-action.button-primary > span, .topbar-action.button-expense > span { color: #080808; }
  .stat-grid-compact { grid-template-columns: 1fr 1fr; }
  .period-buttons { grid-template-columns: 1fr; padding: .8rem 1rem 0; }
  .period-button { min-height: 58px; }
  .counter-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .counter-card { min-height: 94px; padding: .8rem; }
  .counter-card > span { width: 32px; height: 32px; }
  .report-grid-finance { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .mobile-action-dock { position: fixed; inset: auto 0 0; z-index: 45; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; min-height: 66px; padding: .35rem max(.4rem, env(safe-area-inset-right)) calc(.35rem + env(safe-area-inset-bottom)) max(.4rem, env(safe-area-inset-left)); border-top: 1px solid var(--border-gold); background: rgba(10,10,10,.96); box-shadow: 0 -12px 35px rgba(0,0,0,.4); backdrop-filter: blur(16px); }
  .mobile-action-dock a { display: flex; min-width: 0; align-items: center; justify-content: center; flex-direction: column; gap: .12rem; border-radius: 10px; color: var(--text-soft); }
  .mobile-action-dock a:active { color: var(--gold-light); background: var(--gold-faint); }
  .mobile-action-dock span { color: var(--gold); font-size: 1.05rem; font-weight: 900; }
  .mobile-action-dock small { overflow: hidden; max-width: 100%; font-size: .62rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
  .sticky-mobile-actions { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 12; margin: 1rem -1rem -1rem; padding: .8rem 1rem; border-top: 1px solid var(--border); background: rgba(14,14,14,.96); backdrop-filter: blur(12px); }
  .mobile-card-table { padding: .7rem; overflow: visible; }
  .mobile-card-table table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table tr { margin-bottom: .75rem; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-soft); }
  .mobile-card-table td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: .65rem; padding: .65rem .75rem; border-top: 1px solid var(--border); text-align: left; }
  .mobile-card-table td:first-child { border-top: 0; }
  .mobile-card-table td::before { content: attr(data-label); color: var(--muted); font-size: .64rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .mobile-card-table .row-actions { align-items: stretch; justify-content: flex-start; flex-direction: row; flex-wrap: wrap; }
  .mobile-card-table .row-actions .button { flex: 1; }
  .mobile-card-table .table-secondary { max-width: 100%; }
}

@media (max-width: 460px) {
  .stat-grid-compact { grid-template-columns: 1fr; }
  .counter-grid { grid-template-columns: 1fr; }
  .topbar-actions { max-width: 45vw; }
  .mobile-card-table td { grid-template-columns: 92px minmax(0, 1fr); }
}

@media print {
  .mobile-action-dock, .period-buttons, .install-modal { display: none !important; }
}

/* v1.3 supplier ledger, recipes, counter requests and correction controls */
.nav-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 .38rem;
  place-items: center;
  border: 1px solid rgba(255, 120, 120, .55);
  border-radius: 999px;
  color: #fff;
  background: #a31919;
  font-size: .66rem;
  font-weight: 900;
  line-height: 1;
}
.alarm-badge { animation: badgePulse 1.1s infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 70, 70, .48); transform: scale(1); }
  50% { box-shadow: 0 0 0 7px rgba(255, 70, 70, 0); transform: scale(1.06); }
}

.button-request {
  border-color: rgba(255, 135, 90, .52);
  color: #ffe8dc;
  background: linear-gradient(135deg, rgba(137, 39, 16, .92), rgba(73, 18, 9, .96));
}
.button-request:hover { border-color: rgba(255, 170, 120, .8); background: #7f2413; }
.request-alarm { animation: requestPulse 1.25s infinite; }
@keyframes requestPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 82, 45, .45); }
  50% { box-shadow: 0 0 0 7px rgba(255, 82, 45, 0), 0 0 20px rgba(255, 82, 45, .2); }
}
.quick-action-alert {
  border-color: rgba(255, 80, 80, .62);
  background: radial-gradient(circle at 100% 0, rgba(255, 44, 44, .18), transparent 55%), var(--panel-soft);
  animation: requestPulse 1.35s infinite;
}

.badge-counter_manager { color: #ffcfaa; background: rgba(191, 79, 24, .14); border-color: rgba(255, 165, 108, .3); }
.badge-request { text-transform: capitalize; }
.badge-pending { color: #ffd78b; background: rgba(214, 144, 24, .14); border-color: rgba(255, 199, 87, .34); }
.badge-fulfilled { color: var(--success); background: var(--success-bg); border-color: rgba(142, 214, 164, .3); }
.badge-rejected { color: var(--danger); background: var(--danger-bg); border-color: rgba(255, 125, 125, .3); }
.badge-cancelled { color: var(--muted); background: rgba(255,255,255,.04); border-color: var(--border); }

.ingredient-list { display: grid; gap: .7rem; }
.ingredient-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(115px, .7fr) minmax(125px, .7fr) auto;
  align-items: end;
  gap: .7rem;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.015);
}
.ingredient-row .form-group { margin: 0; }
.ingredient-remove { min-width: 42px; height: 42px; padding: 0; }

.tab-links {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding: 0 1.2rem 1rem;
  scrollbar-width: thin;
}
.tab-link {
  flex: 0 0 auto;
  padding: .62rem .85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255,255,255,.018);
  font-size: .73rem;
  font-weight: 800;
}
.tab-link:hover, .tab-link.active { border-color: var(--border-gold); color: #080808; background: var(--gold-light); }

.return-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.return-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 135px) auto;
  align-items: center;
  gap: .65rem;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.015);
}
.return-item > span { display: flex; min-width: 0; flex-direction: column; }
.return-item > span strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.return-item > span small, .return-item em { color: var(--muted); font-size: .68rem; font-style: normal; }
.inline-reason { width: min(320px, 100%); }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1.2rem;
  border-color: rgba(255, 100, 100, .3);
  background: radial-gradient(circle at 100% 0, rgba(180, 24, 24, .12), transparent 55%), var(--panel);
}
.danger-zone > div { min-width: 0; }
.danger-zone h2 { margin: .15rem 0 .35rem; }
.danger-zone p:last-child { margin: 0; color: var(--muted); font-size: .78rem; }
.danger-zone form { flex: 0 0 auto; }

@media (max-width: 900px) {
  .ingredient-row { grid-template-columns: minmax(0, 1fr) minmax(105px, .55fr) minmax(110px, .55fr) auto; }
  .return-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .ingredient-row { grid-template-columns: 1fr 1fr; }
  .ingredient-row .form-group:first-child { grid-column: 1 / -1; }
  .ingredient-remove { width: 100%; min-width: 0; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone form, .danger-zone .button { width: 100%; }
  .tab-links { padding-inline: .85rem; }
  .return-item { grid-template-columns: minmax(0, 1fr) minmax(90px, 120px) auto; }
}

@media (max-width: 460px) {
  .ingredient-row { grid-template-columns: 1fr; }
  .ingredient-row .form-group:first-child { grid-column: auto; }
  .return-item { grid-template-columns: 1fr auto; }
  .return-item > span { grid-column: 1 / -1; }
  .inline-reason { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .stat-alarm, .alarm-badge, .request-alarm, .quick-action-alert { animation: none !important; }
}

/* v1.4 dashboard counter graphs, granular permissions and supplier payment */
.dashboard-stat-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .75rem;
}
.dashboard-stat-row .stat-card {
  min-height: 106px;
  gap: .7rem;
  padding: .95rem;
}
.dashboard-stat-row .stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1rem;
}
.dashboard-stat-row .stat-label { font-size: .68rem; }
.dashboard-stat-row .stat-card strong { font-size: clamp(1.05rem, 1.55vw, 1.38rem); }
.dashboard-stat-row .stat-card small { font-size: .61rem; }
.dashboard-chart-heading { margin-top: 1.1rem; }
.counter-usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.counter-usage-card {
  min-height: 315px;
  padding: 1rem;
  overflow: visible;
}
.counter-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .7rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--border);
}
.counter-chart-header h3 {
  margin: .12rem 0;
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
}
.counter-chart-header small { color: var(--muted); font-size: .66rem; }
.chart-detail-link {
  flex: 0 0 auto;
  padding: .32rem .52rem;
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  color: var(--gold-light);
  background: var(--gold-faint);
  font-size: .62rem;
  font-weight: 800;
  white-space: nowrap;
}
.chart-detail-link:hover { border-color: var(--gold); background: rgba(212,175,55,.2); }
.counter-bar-chart { display: grid; gap: .72rem; padding-top: .9rem; }
.counter-bar-row { display: grid; gap: .32rem; }
.counter-bar-copy { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.counter-bar-copy a, .counter-bar-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: .71rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.counter-bar-copy a:hover { color: var(--gold-light); }
.counter-bar-copy span { flex: 0 0 auto; color: var(--muted); font-size: .59rem; white-space: nowrap; }
.counter-bar-row progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #24211a;
  appearance: none;
  -webkit-appearance: none;
}
.counter-bar-row progress::-webkit-progress-bar { border-radius: 999px; background: #24211a; }
.counter-bar-row progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); }
.counter-bar-row progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); }
.mini-empty-state {
  display: flex;
  min-height: 215px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.mini-empty-state > span {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: .65rem;
  place-items: center;
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  color: var(--gold);
  background: var(--gold-faint);
  font-size: 1.1rem;
}
.mini-empty-state strong { font-size: .8rem; }
.mini-empty-state small { max-width: 210px; margin-top: .2rem; color: var(--muted); font-size: .67rem; }
.access-summary-list { display: flex; flex-wrap: wrap; gap: .45rem; padding: 1rem 1.2rem 0; }
.empty-state.compact { min-height: 170px; }

.permission-section {
  overflow: hidden;
  margin: .25rem 0 .65rem;
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  background: rgba(212,175,55,.035);
}
.permission-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.permission-section-header h3 { margin: 0; color: var(--text); }
.permission-section-header p:not(.eyebrow) { margin: .28rem 0 0; color: var(--muted); font-size: .72rem; }
.permission-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .62rem;
  padding: 1rem;
}
.permission-option {
  position: relative;
  display: flex;
  min-height: 74px;
  align-items: flex-start;
  gap: .7rem;
  padding: .78rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255,255,255,.018);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.permission-option:hover { transform: translateY(-1px); border-color: var(--gold-dark); background: var(--gold-faint); }
.permission-option:has(.permission-checkbox:checked) { border-color: var(--border-gold); background: var(--gold-faint); }
.permission-checkbox {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin: .12rem 0 0;
  accent-color: var(--gold);
}
.permission-option > span { display: flex; min-width: 0; flex-direction: column; }
.permission-option strong { color: var(--text); font-size: .76rem; }
.permission-option small { margin-top: .18rem; color: var(--muted); font-size: .64rem; line-height: 1.35; }
.permission-admin-note { margin: 0 1rem 1rem; }
.permission-badge-list { display: flex; max-width: 420px; flex-wrap: wrap; gap: .25rem; }
.permission-badge-list .badge { font-size: .56rem; }

.purchase-followup-banner {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 1rem 1rem 0;
  padding: .9rem;
  border: 1px solid rgba(142,214,164,.34);
  border-radius: 12px;
  background: var(--success-bg);
}
.purchase-followup-banner > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #08110b;
  background: var(--success);
  font-weight: 950;
}
.purchase-followup-banner strong { color: var(--success); font-size: .8rem; }
.purchase-followup-banner p { margin: .15rem 0 0; color: var(--text-soft); font-size: .7rem; }
.supplier-payment-summary { margin-inline: auto; }
.nav-link-payment .nav-icon { color: var(--success); }

@media (max-width: 1380px) {
  .dashboard-stat-row { gap: .6rem; }
  .dashboard-stat-row .stat-card { min-height: 100px; padding: .78rem; }
  .dashboard-stat-row .stat-icon { width: 34px; height: 34px; }
}

@media (max-width: 1220px) {
  .counter-usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .dashboard-stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .dashboard-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .dashboard-stat-row .stat-card { min-height: 96px; }
  .counter-usage-grid { grid-template-columns: 1fr; gap: .7rem; }
  .counter-usage-card { min-height: 270px; padding: .85rem; }
  .mini-empty-state { min-height: 165px; }
  .permission-section-header { flex-direction: column; }
  .permission-toolbar { width: 100%; justify-content: stretch; }
  .permission-toolbar .button { flex: 1 1 130px; }
  .permission-grid { grid-template-columns: 1fr; padding: .75rem; }
  .permission-option { min-height: 68px; }
  .permission-badge-list { max-width: none; }
  .purchase-followup-banner { margin: .8rem .8rem 0; }
}

@media (max-width: 460px) {
  .dashboard-stat-row { grid-template-columns: 1fr; }
  .counter-bar-copy { align-items: flex-start; flex-direction: column; gap: .1rem; }
  .counter-bar-copy span { white-space: normal; }
}

@media print {
  .counter-usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .permission-toolbar, .chart-detail-link { display: none !important; }
}

/* v1.4.1 — immediate payment for unregistered Random_Supplier purchases */
.instant-payment-panel {
  margin: .2rem 0 1rem;
  padding: 1rem;
  border: 1px solid rgba(212,175,55,.38);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(212,175,55,.1), rgba(255,255,255,.012));
}
.instant-payment-panel[hidden] { display: none; }
.instant-payment-heading { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .85rem; }
.instant-payment-heading > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  color: #101010;
  background: var(--gold);
  font-size: 1rem;
  font-weight: 950;
}
.instant-payment-heading strong { color: var(--gold-light); font-size: .84rem; }
.instant-payment-heading p { margin: .18rem 0 0; color: var(--text-soft); font-size: .7rem; line-height: 1.5; }
.instant-payment-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
  padding: .7rem .8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.22);
}
.instant-payment-amount span { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.instant-payment-amount strong { color: var(--gold-light); font-family: Georgia, serif; font-size: 1.15rem; }
.instant-payment-detail { color: var(--success); }
.supplier-payment-focus { background: rgba(212,175,55,.09); box-shadow: inset 3px 0 0 var(--gold); }

@media (max-width: 520px) {
  .instant-payment-panel { padding: .8rem; }
  .instant-payment-heading p { font-size: .67rem; }
  .instant-payment-amount { align-items: flex-start; flex-direction: column; gap: .25rem; }
}

/* v1.5 purchaser approval workflow */
.nav-link-approval .nav-icon { color: var(--warning); }
.approval-notice {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin: 0 0 1rem;
  padding: .95rem;
  border: 1px solid rgba(245,199,96,.35);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(245,199,96,.12), rgba(255,255,255,.012));
}
.approval-notice > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-gold);
  border-radius: 50%;
  color: #101010;
  background: var(--gold);
  font-weight: 950;
}
.approval-notice strong { color: var(--gold-light); font-size: .84rem; }
.approval-notice p { margin: .2rem 0 .4rem; color: var(--text-soft); font-size: .72rem; line-height: 1.5; }
.approval-danger { border-color: rgba(255,125,125,.36); background: var(--danger-bg); }
.approval-danger > span { border-color: rgba(255,125,125,.45); color: #180505; background: var(--danger); }
.approval-danger strong { color: var(--danger); }
.approval-dashboard-panel {
  margin: 0 0 1rem;
  border-color: rgba(255,170,120,.42);
  box-shadow: 0 0 0 1px rgba(255,170,120,.06), 0 0 26px rgba(255,70,70,.09);
}
.approval-pending-panel { animation: requestPulse 1.35s infinite; }
.approval-rejected-panel { border-color: rgba(255,125,125,.45); }
.purchase-rejected-row { background: rgba(255, 125, 125, .055); }
.badge-pending { border-color: rgba(245,199,96,.35); color: var(--warning); background: var(--warning-bg); }
.badge-approved { border-color: rgba(142,214,164,.32); color: var(--success); background: var(--success-bg); }
.badge-rejected { border-color: rgba(255,125,125,.35); color: var(--danger); background: var(--danger-bg); }
.soft-separator { margin: 1rem 0; border: 0; border-top: 1px solid var(--border); }
.compact-list .activity-item { padding-block: .62rem; }

@media (max-width: 720px) {
  .approval-notice { margin-inline: 0; padding: .8rem; }
  .approval-dashboard-panel .activity-item { align-items: flex-start; flex-direction: column; }
}
.approval-reason {
  color: var(--danger);
  font-weight: 700;
}


/* v1.6 — liquid units, packet purchases and personal history */
.product-cost-note { margin: -.15rem 0 .5rem; }
.pack-purchase-panel {
  margin: .05rem 0 1rem;
  padding: 1rem;
  border: 1px solid rgba(212,175,55,.28);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(212,175,55,.08), rgba(255,255,255,.012));
}
.pack-purchase-panel[hidden] { display: none; }
.pack-purchase-heading { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .85rem; }
.pack-purchase-heading > span {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  color: #111;
  background: var(--gold);
  font-weight: 950;
}
.pack-purchase-heading strong { color: var(--gold-light); font-size: .84rem; }
.pack-purchase-heading p { margin: .18rem 0 0; color: var(--text-soft); font-size: .7rem; line-height: 1.5; }
.pack-purchase-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .85rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.2);
}
.pack-purchase-total span { color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.pack-purchase-total strong { color: var(--gold-light); font-family: Georgia, serif; font-size: 1rem; }
.nav-link-history .nav-icon { color: var(--info); }
.history-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 0 0 1rem; }
.history-summary-card { padding: 1rem; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.018); }
.history-summary-card small { display: block; color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.history-summary-card strong { display: block; margin-top: .28rem; color: var(--gold-light); font-family: Georgia, serif; font-size: 1.15rem; }
@media (max-width: 720px) {
  .pack-purchase-panel { padding: .8rem; }
  .pack-purchase-total { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .history-summary-grid { grid-template-columns: 1fr; }
}
