:root {
  --blue: #07549b;
  --blue-dark: #073f73;
  --blue-soft: #eaf3fb;
  --red: #e02b2b;
  --red-soft: #fff0f0;
  --yellow: #f2b705;
  --yellow-soft: #fff8dc;
  --green: #17845d;
  --green-soft: #eaf7f2;
  --ink: #142033;
  --muted: #66758a;
  --subtle: #8c99aa;
  --canvas: #f4f7fa;
  --panel: #ffffff;
  --border: #dfe5ec;
  --border-strong: #cbd5e1;
  --shadow: 0 12px 32px rgba(18, 36, 58, 0.08);
  --sidebar-width: 270px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 17px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

button, input, textarea, select {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--blue-dark);
}

svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  place-items: center;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  color: var(--blue-dark);
  font-size: 23px;
  font-weight: 800;
}

.brand-copy strong span {
  color: var(--red);
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Authentication */
.auth-body {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  background: #f8fafc;
}

.auth-header,
.auth-footer {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.auth-header {
  display: flex;
  min-height: 100px;
  align-items: center;
}

.auth-footer {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.auth-shell {
  display: grid;
  width: min(1120px, calc(100% - 48px));
  min-height: 620px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 480px);
  align-items: center;
  gap: 80px;
  padding: 40px 0 64px;
}

.auth-shell-register {
  grid-template-columns: minmax(320px, 0.8fr) minmax(500px, 1.2fr);
  gap: 64px;
}

.auth-intro {
  max-width: 540px;
}

.eyebrow,
.page-eyebrow,
.panel-kicker {
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow > span {
  width: 24px;
  height: 3px;
  background: var(--yellow);
}

.auth-intro h1 {
  max-width: 520px;
  margin: 18px 0 18px;
  color: var(--blue-dark);
  font-size: 48px;
  font-weight: 800;
  line-height: 1.08;
}

.compact-intro h1 {
  font-size: 42px;
}

.auth-intro > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.auth-feature-list {
  display: grid;
  gap: 18px;
  margin-top: 40px;
}

.auth-feature-list > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feature-icon,
.summary-icon,
.metric-icon {
  display: inline-grid;
  place-items: center;
}

.feature-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
}

.feature-icon-blue { color: var(--blue); background: var(--blue-soft); }
.feature-icon-red { color: var(--red); background: var(--red-soft); }
.feature-icon-yellow { color: #9a7100; background: var(--yellow-soft); }

.auth-feature-list strong,
.auth-feature-list small {
  display: block;
}

.auth-feature-list strong {
  font-size: 16px;
}

.auth-feature-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 15px;
}

.trust-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  color: var(--green);
  font-size: 15px;
  font-weight: 700;
}

.auth-panel {
  width: 100%;
  padding: 38px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel-wide {
  padding: 34px 38px;
}

.auth-panel-compact {
  width: min(440px, calc(100% - 32px));
}

.auth-panel-heading {
  margin-bottom: 28px;
}

.auth-panel-heading h1,
.auth-panel-heading h2,
.auth-panel h1 {
  margin: 7px 0 7px;
  color: var(--blue-dark);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
}

.auth-panel-heading p,
.auth-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.stack-form {
  display: grid;
  gap: 22px;
}

.form-grid {
  display: grid;
  gap: 20px;
}

.form-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field-span-2 {
  grid-column: span 2;
}

.form-field label,
.filter-form label {
  display: block;
  margin-bottom: 8px;
  color: #28374a;
  font-size: 15px;
  font-weight: 700;
}

.form-field input,
.form-field textarea,
.form-field select,
.search-form input,
.filter-form select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 12px 14px;
}

.form-field textarea {
  min-height: 108px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.search-form:focus-within,
.filter-form select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(7, 84, 155, 0.12);
}

.form-field input::placeholder,
.form-field textarea::placeholder,
.search-form input::placeholder {
  color: #9aa6b6;
}

.input-with-icon {
  position: relative;
}

.input-with-icon > svg {
  position: absolute;
  top: 15px;
  left: 14px;
  width: 20px;
  color: var(--subtle);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 46px;
}

.password-input input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 5px;
  display: grid;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  place-items: center;
}

.password-toggle:hover {
  color: var(--blue);
}

.password-toggle svg {
  width: 20px;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.label-row a {
  font-size: 14px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 15px;
}

.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.field-error {
  display: block;
  min-height: 0;
  margin-top: 5px;
  color: var(--red);
  font-size: 13px;
}

.field-error:empty {
  display: none;
}

.validation-summary {
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  border-radius: 4px;
  background: var(--red-soft);
  color: #9f2020;
  font-size: 14px;
}

.validation-summary:empty,
.validation-summary.validation-summary-valid {
  display: none;
}

.validation-summary ul {
  margin: 0;
  padding-left: 18px;
}

.form-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-left: 3px solid var(--yellow);
  border-radius: 4px;
  background: var(--yellow-soft);
  color: #715a00;
  font-size: 14px;
  line-height: 1.45;
}

.form-notice svg {
  width: 19px;
  min-width: 19px;
}

.form-notice a {
  color: var(--blue-dark);
  font-weight: 750;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button svg {
  width: 20px;
  height: 20px;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  background: var(--blue-dark);
  color: #fff;
}

.button-secondary {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--ink);
}

.button-secondary:hover,
.button-quiet:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-full {
  width: 100%;
}

.auth-panel-footer {
  display: flex;
  margin: 26px -38px -38px;
  padding: 18px 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  background: #fbfcfd;
  color: var(--muted);
  font-size: 15px;
}

.auth-panel-wide .auth-panel-footer {
  margin-bottom: -34px;
}

.auth-panel-footer a {
  font-weight: 750;
}

.single-auth-shell {
  display: grid;
  min-height: 600px;
  padding: 48px 0 72px;
  place-items: center;
}

.success-symbol,
.error-symbol {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 8px;
  place-items: center;
}

.success-symbol { color: var(--green); background: var(--green-soft); }
.error-symbol { color: var(--red); background: var(--red-soft); }
.success-symbol svg, .error-symbol svg { width: 32px; height: 32px; }

/* Merchant shell */
.merchant-body {
  overflow-x: hidden;
  background: var(--canvas);
}

.merchant-sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid #0a467c;
  background: var(--blue-dark);
  color: #fff;
}

.sidebar-brand {
  min-height: 90px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand .brand-copy strong,
.sidebar-brand .brand-copy strong span {
  color: #fff;
}

.sidebar-brand .brand-copy small {
  color: #a9c4dd;
}

.merchant-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px;
}

.nav-section-label {
  margin: 13px 12px 7px;
  color: #8fb1cf;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.merchant-nav a {
  position: relative;
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #dce9f4;
  font-size: 15px;
  font-weight: 650;
}

.merchant-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.merchant-nav a.is-active {
  background: #fff;
  color: var(--blue-dark);
}

.merchant-nav a.is-active::before {
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: var(--yellow);
  content: "";
  inset: 8px auto 8px -3px;
}

.merchant-nav svg {
  width: 21px;
  height: 21px;
}

.sidebar-status {
  display: flex;
  margin: 14px;
  padding: 13px;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  font-size: 13px;
}

.sidebar-status small {
  margin-top: 2px;
  color: #a9c4dd;
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: currentColor;
}

.sidebar-status .status-dot {
  margin-top: 5px;
}

.status-dot-online {
  color: #4bd2a0;
  box-shadow: 0 0 0 3px rgba(75, 210, 160, 0.16);
}

.merchant-workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.merchant-topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  height: 76px;
  padding: 0 28px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-spacer {
  flex: 1;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  place-items: center;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--border);
  background: #f5f7fa;
  color: var(--blue);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.icon-button-small {
  width: 36px;
  height: 36px;
}

.mobile-menu-button {
  display: none;
}

.account-chip {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.account-chip:hover {
  color: var(--ink);
}

.account-avatar,
.business-avatar {
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.account-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  font-size: 15px;
}

.account-copy strong,
.account-copy small {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong { font-size: 14px; }
.account-copy small { color: var(--muted); font-size: 12px; }

.merchant-main {
  position: relative;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 34px 36px 60px;
}

.app-toast {
  position: fixed;
  z-index: 80;
  top: 82px;
  right: 24px;
  display: flex;
  max-width: 380px;
  min-height: 54px;
  padding: 8px 9px 8px 14px;
  align-items: center;
  gap: 10px;
  border: 1px solid #b9dfd0;
  border-radius: 6px;
  background: #f2fbf7;
  box-shadow: var(--shadow);
  color: #146a4d;
  font-size: 15px;
}

.app-toast > svg { width: 21px; }
.app-toast .icon-button { margin-left: auto; }

.page-header {
  display: flex;
  min-height: 102px;
  margin-bottom: 24px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-header h1 {
  margin: 4px 0 4px;
  color: var(--ink);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 9px;
}

.page-header-form {
  min-height: auto;
}

.back-link {
  display: inline-flex;
  margin-bottom: 9px;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.back-link svg { width: 17px; }

.metric-grid {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.metric-card,
.content-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card {
  position: relative;
  min-width: 0;
  min-height: 165px;
  padding: 22px;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  width: 3px;
  background: var(--border-strong);
  content: "";
  inset: 0 auto 0 0;
}

.metric-card-primary::before { background: var(--blue); }
.metric-card-warning::before { background: var(--yellow); }

.metric-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-icon svg { width: 20px; }
.metric-icon-red { background: var(--red-soft); color: var(--red); }
.metric-icon-yellow { background: var(--yellow-soft); color: #946d00; }
.metric-icon-neutral { background: #edf1f5; color: #5d6c7e; }

.metric-value {
  display: block;
  margin-top: 13px;
  overflow: hidden;
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value small {
  color: var(--subtle);
  font-size: 17px;
  font-weight: 700;
}

.metric-note {
  display: flex;
  min-height: 20px;
  margin-top: 8px;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.metric-note svg { width: 16px; height: 16px; }
.metric-up { color: var(--green); }
.metric-down { color: var(--red); }

.dashboard-grid {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: minmax(0, 1.75fr) minmax(290px, 0.75fr);
  gap: 18px;
}

.content-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  min-height: 82px;
  padding: 20px 22px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2,
.form-section-heading h2,
.editor-actions h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.panel-header p,
.form-section-heading p,
.editor-actions p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.panel-link svg { width: 16px; }

.chart-wrap {
  position: relative;
  height: 290px;
  padding: 18px 20px 16px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.rank-list {
  margin: 0;
  padding: 8px 20px 12px;
  list-style: none;
}

.rank-list li {
  display: grid;
  min-height: 64px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #edf0f4;
}

.rank-list li:last-child { border-bottom: 0; }

.rank-number {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #f0f3f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.rank-name,
.rank-name strong,
.rank-name small {
  display: block;
  min-width: 0;
}

.rank-name strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-name small,
.rank-value {
  color: var(--muted);
  font-size: 12px;
}

.rank-value {
  color: var(--ink);
  font-weight: 750;
}

.compact-empty,
.table-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  min-height: 245px;
  flex-direction: column;
  padding: 28px;
}

.compact-empty svg {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  color: #9aa8b8;
}

.compact-empty p {
  max-width: 220px;
  margin: 0;
  font-size: 14px;
}

.table-empty {
  min-height: 290px;
  flex-direction: column;
  padding: 42px 24px;
}

.table-empty > span {
  display: grid;
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  place-items: center;
}

.table-empty > span svg { width: 29px; height: 29px; }

.table-empty h2,
.table-empty h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.table-empty p {
  max-width: 430px;
  margin: 0 0 17px;
  font-size: 14px;
}

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

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.product-table { min-width: 1180px; }
.machine-table { min-width: 1060px; }
.machine-products-table { min-width: 960px; }
.machine-selection-table { min-width: 850px; }

.data-table th,
.data-table td {
  height: 68px;
  padding: 12px 20px;
  border-bottom: 1px solid #e8edf2;
  color: #3f4e61;
  font-size: 14px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  height: 46px;
  background: #f8fafc;
  color: #718096;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table td strong { color: var(--ink); }
.data-table .text-end { text-align: right; }

.status-badge {
  display: inline-flex;
  min-height: 30px;
  padding: 5px 10px;
  align-items: center;
  gap: 6px;
  border-radius: 5px;
  background: #edf1f5;
  color: #586779;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-active,
.status-online,
.status-paid,
.status-dispensed,
.status-succeeded { background: var(--green-soft); color: #126747; }
.status-offline,
.status-failed,
.status-timedout,
.status-cancelled { background: var(--red-soft); color: #a72020; }
.status-maintenance,
.status-pending,
.status-paymentpending,
.status-queued,
.status-sent { background: var(--yellow-soft); color: #846300; }
.status-archived,
.status-notrequested,
.status-refunded { background: #edf1f5; color: #5d6c7e; }

.summary-strip {
  display: grid;
  margin-bottom: 18px;
  padding: 16px 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.summary-strip-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-strip > div {
  display: flex;
  min-height: 56px;
  padding: 0 18px;
  align-items: center;
  gap: 11px;
  border-right: 1px solid var(--border);
}

.summary-strip > div:first-child { padding-left: 0; }
.summary-strip > div:last-child { border-right: 0; }

.summary-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 7px;
}

.summary-icon svg { width: 20px; }
.summary-icon-blue { color: var(--blue); background: var(--blue-soft); }
.summary-icon-red { color: var(--red); background: var(--red-soft); }
.summary-icon-yellow { color: #8a6700; background: var(--yellow-soft); }
.summary-icon-green { color: var(--green); background: var(--green-soft); }

.summary-strip strong,
.summary-strip small {
  display: block;
}

.summary-strip strong { font-size: 18px; }
.summary-strip small { color: var(--muted); font-size: 12px; }

.table-toolbar {
  display: flex;
  min-height: 76px;
  padding: 13px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.search-form {
  display: flex;
  width: min(420px, 100%);
  height: 46px;
  padding: 0 8px 0 12px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.search-form > svg { width: 20px; color: var(--subtle); }
.search-form input { min-height: 42px; padding: 0; border: 0; box-shadow: none; }
.search-form input:focus { box-shadow: none; }

.result-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

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

.product-cell > span:last-child,
.cell-subtitle {
  display: block;
}

.cell-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.product-thumb,
.machine-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  overflow: hidden;
  border-radius: 6px;
  background: #eef3f7;
  color: var(--blue);
  place-items: center;
}

.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb svg, .machine-icon svg { width: 21px; }

.machine-cell > span:last-child,
.machine-cell strong,
.machine-cell small {
  display: block;
}

.machine-cell small {
  display: flex;
  max-width: 220px;
  margin-top: 2px;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.machine-cell small svg { width: 13px; height: 13px; }

.machine-name-link,
.machine-cell-link {
  color: var(--ink);
}

.machine-name-link:hover,
.machine-cell-link:hover {
  color: var(--blue);
}

.machine-cell-link,
.machine-cell-link strong,
.machine-cell-link small {
  display: block;
}

.machine-cell-link {
  min-width: 170px;
}

.machine-cell-link small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.machine-cell-link .status-dot {
  margin-right: 6px;
}

.machine-status-online { color: var(--green) !important; }
.machine-status-offline { color: var(--red) !important; }
.machine-status-maintenance { color: #846300 !important; }

.code-text {
  padding: 5px 8px;
  border-radius: 4px;
  background: #f1f4f7;
  color: #46566a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.stock-value { font-weight: 700; }
.stock-low { color: var(--red); }

.table-actions {
  display: flex;
  min-width: 106px;
  justify-content: flex-end;
  gap: 2px;
}

.table-actions form { margin: 0; }

.table-command {
  text-align: right !important;
  white-space: nowrap;
}

.inline-warning {
  margin-left: 5px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 22px;
}

.editor-layout-narrow {
  max-width: 920px;
}

.editor-panel {
  padding: 28px;
}

.device-context-row {
  display: flex;
  min-height: 66px;
  margin-bottom: 26px;
  padding: 10px 12px;
  align-items: center;
  gap: 12px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
}

.device-context-row > span:last-child,
.device-context-row strong,
.device-context-row small {
  display: block;
}

.device-context-row strong {
  font-size: 15px;
}

.device-context-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.device-meta-line {
  display: flex;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 13px;
}

.device-meta-line span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.device-meta-line svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.device-meta-line strong {
  color: var(--ink);
}

.form-section-heading {
  margin-bottom: 20px;
}

.form-divider {
  height: 1px;
  margin: 26px 0;
  background: var(--border);
}

.input-prefix {
  display: flex;
  align-items: stretch;
}

.input-prefix span {
  display: grid;
  min-width: 62px;
  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  background: #f5f7fa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.input-prefix input {
  border-radius: 0 6px 6px 0;
}

.toggle-row {
  display: flex;
  margin-top: 24px;
  min-height: 68px;
  padding: 17px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafbfd;
}

.toggle-row strong,
.toggle-row small { display: block; }
.toggle-row strong { font-size: 15px; }
.toggle-row small { margin-top: 2px; color: var(--muted); font-size: 13px; }

.toggle-input {
  position: relative;
  width: 46px !important;
  min-height: 26px !important;
  flex: 0 0 46px;
  border: 0 !important;
  border-radius: 12px !important;
  appearance: none;
  background: #b9c4d1 !important;
  cursor: pointer;
}

.toggle-input::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 150ms ease;
}

.toggle-input:checked { background: var(--blue) !important; }
.toggle-input:checked::after { transform: translateX(20px); }

.editor-actions {
  position: sticky;
  top: 94px;
  padding: 24px;
}

.editor-actions p {
  margin-bottom: 18px;
  line-height: 1.6;
}

.editor-actions .button + .button { margin-top: 6px; }

.filter-form {
  display: flex;
  align-items: center;
  gap: 9px;
}

.filter-form label { margin: 0; }
.filter-form select { min-width: 170px; min-height: 46px; padding: 9px 12px; }

.report-chart-panel { margin-bottom: 18px; }
.chart-wrap-large { height: 320px; }
.report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.performance-list {
  padding: 8px 20px 12px;
}

.performance-list > div {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf0f4;
}

.performance-list > div:last-child { border-bottom: 0; }
.performance-list span, .performance-list strong, .performance-list small { display: block; }
.performance-list span:last-child { text-align: right; }
.performance-list strong { font-size: 14px; }
.performance-list small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.performance-list b { margin-left: 4px; color: var(--red); }

.account-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.account-summary {
  padding: 26px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.business-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 8px;
  font-size: 28px;
}

.account-summary h2 { margin: 0; font-size: 18px; font-weight: 800; }
.account-summary > p { margin: 4px 0 20px; color: var(--muted); font-size: 13px; }
.account-summary dl { margin: 0; text-align: left; }

.account-summary dl > div {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.account-summary dt { color: var(--muted); font-weight: 650; }
.account-summary dd { max-width: 150px; margin: 0; overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.account-editor { max-width: 850px; }
.form-actions-row { display: flex; margin-top: 26px; justify-content: flex-end; }

.device-provisioning {
  display: flex;
  min-height: 96px;
  margin-bottom: 18px;
  padding: 20px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.device-provisioning-copy {
  display: flex;
  min-width: 250px;
  align-items: center;
  gap: 13px;
}

.device-provisioning-copy h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.device-provisioning-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.device-secret-reveal {
  width: min(610px, 100%);
}

.device-secret-reveal label {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.device-secret-reveal > div {
  display: flex;
  gap: 8px;
}

.device-secret-reveal input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 14px;
}

.sidebar-backdrop { display: none; }

/* Public QR state */
.public-body {
  display: grid;
  background: #f7f9fc;
  place-items: center;
}

.storefront-state {
  display: grid;
  width: min(480px, calc(100% - 32px));
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  padding: 28px 0;
}

.public-brand { justify-self: center; }

.storefront-state section {
  align-self: center;
  padding: 32px 24px;
  text-align: center;
}

.storefront-symbol {
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 20px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  place-items: center;
}

.storefront-symbol svg { width: 38px; height: 38px; }

.storefront-state h1 {
  margin: 0 0 9px;
  color: var(--blue-dark);
  font-size: 28px;
  font-weight: 800;
}

.storefront-state p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.storefront-symbol-active {
  color: var(--green);
  background: var(--green-soft);
}

.storefront-continue {
  margin-top: 24px;
}

.storefront-state footer {
  color: var(--subtle);
  font-size: 13px;
  text-align: center;
}

.customer-storefront {
  width: 100%;
  min-height: 100vh;
  background: #f7f9fc;
}

.storefront-header {
  display: flex;
  width: min(920px, calc(100% - 40px));
  min-height: 92px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.storefront-header .brand-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.storefront-header .brand-copy strong { font-size: 21px; }
.storefront-header .brand-copy small { font-size: 10px; }

.secure-session {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.secure-session svg { width: 18px; height: 18px; }

.storefront-machine-band {
  width: 100%;
  border-bottom: 4px solid var(--yellow);
  background: var(--blue-dark);
  color: #fff;
}

.storefront-machine-inner {
  display: flex;
  width: min(920px, calc(100% - 40px));
  min-height: 172px;
  margin: 0 auto;
  align-items: center;
  gap: 20px;
}

.storefront-machine-icon {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--yellow);
  place-items: center;
}

.storefront-machine-icon svg { width: 31px; height: 31px; }

.storefront-machine-inner > div > span {
  color: #c8d9ea;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.storefront-machine-inner h1 {
  margin: 5px 0 4px;
  color: #fff;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.2;
}

.storefront-machine-inner p {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 5px;
  color: #d8e4ef;
  font-size: 15px;
}

.storefront-machine-inner p svg { width: 17px; height: 17px; }

.storefront-products {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 52px;
}

.storefront-products > header {
  display: flex;
  margin-bottom: 20px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.storefront-products > header h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

.storefront-products > header > strong {
  color: var(--muted);
  font-size: 14px;
}

.storefront-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.storefront-product {
  display: grid;
  min-width: 0;
  min-height: 148px;
  padding: 14px;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.storefront-product-image {
  display: grid;
  width: 118px;
  height: 118px;
  overflow: hidden;
  border-radius: 7px;
  background: #eef3f7;
  color: var(--blue);
  place-items: center;
}

.storefront-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storefront-product-image svg { width: 38px; height: 38px; }

.storefront-product-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.storefront-product-copy h3 {
  margin: 2px 0 5px;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

.storefront-product-copy > p {
  display: -webkit-box;
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.storefront-product-copy > div {
  display: flex;
  margin-top: auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.storefront-product-copy > div > strong {
  color: var(--blue-dark);
  font-size: 18px;
  font-weight: 850;
}

.storefront-product-copy > div > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.storefront-product-copy > div svg { width: 14px; height: 14px; }

.storefront-empty {
  min-height: 260px;
  padding: 42px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.storefront-empty > svg {
  width: 44px;
  height: 44px;
  color: var(--red);
}

.storefront-empty h2 { margin: 14px 0 5px; font-size: 20px; }
.storefront-empty p { margin: 0; color: var(--muted); }

.storefront-footer {
  display: flex;
  width: min(920px, calc(100% - 40px));
  min-height: 68px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 12px;
}

.storefront-footer span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-weight: 750;
}

.storefront-footer svg { width: 16px; height: 16px; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-shell { gap: 42px; }
  .auth-intro h1 { font-size: 42px; }
}

@media (max-width: 960px) {
  .merchant-sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .merchant-workspace { margin-left: 0; }
  .mobile-menu-button { display: inline-grid; }

  .sidebar-open .merchant-sidebar { transform: translateX(0); }

  .sidebar-open .sidebar-backdrop {
    position: fixed;
    z-index: 40;
    display: block;
    background: rgba(15, 27, 42, 0.42);
    inset: 0;
  }

  .dashboard-grid,
  .report-grid { grid-template-columns: 1fr; }

  .auth-shell,
  .auth-shell-register {
    width: min(620px, calc(100% - 40px));
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .auth-intro { max-width: none; }
  .auth-intro h1 { max-width: 600px; font-size: 38px; }
  .auth-intro > p { font-size: 16px; }
  .auth-feature-list { display: none; }
  .compact-intro { padding-top: 12px; }
}

@media (max-width: 720px) {
  .auth-header,
  .auth-footer { width: calc(100% - 32px); }
  .auth-header { min-height: 84px; }
  .auth-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
  .auth-shell, .auth-shell-register { width: calc(100% - 32px); padding: 20px 0 42px; gap: 25px; }
  .auth-intro h1, .compact-intro h1 { margin-top: 11px; font-size: 31px; }
  .auth-intro > p { font-size: 16px; line-height: 1.55; }
  .auth-panel, .auth-panel-wide { padding: 28px 22px; }
  .auth-panel-footer, .auth-panel-wide .auth-panel-footer { margin: 24px -22px -28px; padding: 18px; }
  .form-grid-two { grid-template-columns: 1fr; }
  .form-field-span-2 { grid-column: auto; }

  .merchant-sidebar { width: min(300px, 88vw); }
  .merchant-topbar { height: 70px; padding: 0 16px; }
  .account-copy { display: none; }
  .merchant-main { padding: 26px 18px 48px; }
  .page-header { min-height: 0; margin-bottom: 22px; flex-direction: column; gap: 14px; }
  .page-header h1 { font-size: 28px; }
  .page-actions { width: 100%; padding-top: 0; }
  .page-actions .button { flex: 1; padding-right: 12px; padding-left: 12px; white-space: nowrap; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 155px; padding: 18px; }
  .metric-value { font-size: 27px; }
  .metric-note { align-items: flex-start; line-height: 1.25; }

  .summary-strip { grid-template-columns: 1fr; padding: 6px 16px; }
  .summary-strip > div { min-height: 58px; padding: 12px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .summary-strip > div:last-child { border-bottom: 0; }
  .table-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .search-form { width: 100%; }
  .result-count { align-self: flex-end; }
  .filter-form { justify-content: space-between; }

  .responsive-inventory-table {
    min-width: 0;
  }

  .responsive-inventory-table thead {
    display: none;
  }

  .responsive-inventory-table tbody,
  .responsive-inventory-table tr,
  .responsive-inventory-table td {
    display: block;
    width: 100%;
  }

  .responsive-inventory-table tr {
    display: grid;
    padding: 16px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    border-bottom: 1px solid var(--border);
  }

  .responsive-inventory-table tr:last-child {
    border-bottom: 0;
  }

  .responsive-inventory-table td,
  .responsive-inventory-table tr:last-child td {
    height: auto;
    padding: 0;
    border: 0;
  }

  .responsive-inventory-table td:first-child,
  .responsive-inventory-table .table-actions {
    grid-column: 1 / -1;
  }

  .responsive-inventory-table td[data-label]::before {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .responsive-inventory-table .table-actions {
    display: flex;
    min-width: 0;
    padding-top: 10px;
    justify-content: flex-start;
    border-top: 1px solid var(--border);
  }

  .responsive-inventory-table .table-actions::before {
    margin-right: auto;
    margin-bottom: 0 !important;
    align-self: center;
  }

  .editor-layout,
  .account-layout { grid-template-columns: 1fr; }
  .editor-actions { position: static; }
  .account-summary { text-align: left; }
  .business-avatar { margin-left: 0; }
  .chart-wrap { height: 250px; padding: 12px; }
  .editor-panel { padding: 22px; }
  .panel-header { min-height: 76px; padding: 17px; }
  .app-toast { right: 12px; left: 12px; max-width: none; }

  .device-provisioning { align-items: stretch; flex-direction: column; }
  .device-secret-reveal > div { align-items: stretch; flex-direction: column; }
  .device-secret-reveal .button { justify-content: center; }

  .storefront-header { width: calc(100% - 32px); min-height: 82px; }
  .storefront-header .brand-copy small { display: none; }
  .storefront-machine-inner { width: calc(100% - 32px); min-height: 154px; }
  .storefront-machine-inner h1 { font-size: 26px; }
  .storefront-products { width: calc(100% - 32px); padding: 28px 0 40px; }
  .storefront-product-grid { grid-template-columns: 1fr; }
  .storefront-footer { width: calc(100% - 32px); }
}

@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 150px; }
  .auth-panel-heading h1, .auth-panel-heading h2 { font-size: 28px; }
  .brand-copy strong { font-size: 22px; }
  .secure-session { font-size: 0; }
  .secure-session svg { width: 22px; height: 22px; }
  .storefront-machine-icon { width: 54px; height: 54px; flex-basis: 54px; }
  .storefront-machine-inner { gap: 14px; }
  .storefront-machine-inner h1 { font-size: 23px; }
  .storefront-product { min-height: 138px; grid-template-columns: 104px minmax(0, 1fr); gap: 13px; }
  .storefront-product-image { width: 104px; height: 104px; }
  .storefront-product-copy > div { align-items: flex-start; flex-direction: column; }
  .storefront-footer { min-height: 82px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
}

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