/* ==========================================================================
   HKM Vizag Book Distribution - design system (UI v2)
   One stylesheet shared by the admin (/admin) and the public/mobile apps
   (/request, /testdistribution, /stallsales, /kkdsales, /sales/matchless,
   /online-classes). Class names and ids are rendered by the JS templates,
   so selectors here must stay in sync with them.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Brand: HKM saffron-brown */
  --brand-950: #2c1307;
  --brand-900: #421f0c;
  --brand-800: #5d2d13;
  --brand-700: #7b3f1d;
  --brand-600: #93502a;
  --brand-500: #ad6a3b;
  --brand-300: #d9ab84;
  --brand-200: #ebd3ba;
  --brand-100: #f5e7d6;
  --brand-50: #fcf6ee;

  --saffron-700: #b45309;
  --saffron-600: #d97706;
  --saffron-500: #ee9a2c;
  --saffron-300: #fbd08e;
  --saffron-100: #fff3dc;

  /* Warm neutrals */
  --ink: #2a1a10;
  --ink-2: #4a3426;
  --muted: #735e4d;
  --subtle: #9a8676;
  --line: #ecdfcf;
  --line-strong: #dac7b0;
  --page: #f8f3ec;
  --panel: #ffffff;
  --panel-soft: #fdf9f4;
  --panel-tint: #faf3ea;

  /* Status */
  --success: #146c43;
  --success-bg: #e5f4eb;
  --success-line: #b9e0c8;
  --warning: #935400;
  --warning-bg: #fff1d6;
  --warning-line: #f5d49a;
  --danger: #b42318;
  --danger-bg: #fdebe9;
  --danger-line: #f2c1bb;
  --info: #1f5fa6;
  --info-bg: #e7f0fb;

  /* Shape, space, type */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Nirmala UI", "Noto Sans Telugu", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  --shadow-xs: 0 1px 2px rgba(66, 31, 12, 0.06);
  --shadow-sm: 0 1px 3px rgba(66, 31, 12, 0.08), 0 1px 2px rgba(66, 31, 12, 0.04);
  --shadow: 0 6px 18px rgba(66, 31, 12, 0.07), 0 1px 3px rgba(66, 31, 12, 0.05);
  --shadow-strong: 0 20px 48px rgba(44, 19, 7, 0.18), 0 4px 12px rgba(44, 19, 7, 0.08);
  --ring: 0 0 0 3px rgba(173, 106, 59, 0.3);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Legacy aliases: older rules referenced a blue palette; map it to the brand. */
  --blue-950: var(--brand-950);
  --blue-900: var(--brand-900);
  --blue-700: var(--brand-700);
  --blue-600: var(--brand-600);
  --teal-600: #0f766e;
  --amber-600: #c47f00;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: rgba(123, 63, 29, 0.12);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--brand-700);
}

img {
  max-width: 100%;
}

::selection {
  background: var(--saffron-300);
  color: var(--brand-950);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand-700);
}

/* Base form controls (zero specificity: every component rule overrides it). */
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"], [type="submit"], [type="button"]), select, textarea) {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

:where(input, select, textarea):hover:not(:disabled):not(:focus) {
  border-color: var(--brand-300);
}

:where(input, select, textarea):focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}

:where(input, select, textarea):disabled,
:where(input, textarea)[readonly] {
  background-color: var(--panel-tint);
  color: var(--muted);
}

::placeholder {
  color: var(--subtle);
  opacity: 1;
}

:where(select):not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%237b3f1d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}

:where(button, a, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Admin shell
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  background: transparent;
  transition: grid-template-columns 0.2s var(--ease);
}

body.auth-mode .app-shell {
  display: none;
}

.auth-root {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(238, 154, 44, 0.18), transparent 60%),
    radial-gradient(800px 520px at 110% 110%, rgba(123, 63, 29, 0.16), transparent 60%),
    var(--page);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-strong);
  padding: 28px 24px 20px;
  text-align: center;
}

.auth-card::before {
  content: "";
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--brand-100) url("/assets/srila-prabhupada-thumb.jpg") center 22% / cover no-repeat;
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--saffron-300), var(--shadow);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: var(--text-xl);
  color: var(--brand-900);
}

.auth-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

.auth-card .form-grid {
  padding: 12px 0 0;
  text-align: left;
}

.auth-card .form-actions {
  margin-top: 4px;
}

.auth-card .form-actions .button {
  width: 100%;
  min-height: 46px;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.main {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow: auto;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(238, 154, 44, 0.16), transparent 70%),
    linear-gradient(180deg, var(--brand-900) 0%, var(--brand-950) 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  padding: 18px 12px 24px;
  color: #f7e9d9;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  padding: 0;
  border-right: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--saffron-300), var(--saffron-500) 55%, var(--saffron-700));
  color: var(--brand-950);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 18px rgba(0, 0, 0, 0.25);
}

.brand-name {
  font-weight: 750;
  color: #fff8ef;
  letter-spacing: 0.005em;
  line-height: 1.25;
}

.brand-subtitle {
  margin-top: 2px;
  color: rgba(247, 233, 217, 0.66);
  font-size: var(--text-sm);
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item {
  position: relative;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(247, 233, 217, 0.8);
  cursor: pointer;
  padding: 10px 12px 10px 16px;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fffaf3;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 700;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--saffron-500);
}

.nav-item:focus-visible {
  box-shadow: 0 0 0 2px var(--saffron-500);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.topbar > div {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
}

.topbar h1 {
  margin: 0;
  font-size: var(--text-xl);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar .small-button {
  flex: 0 0 auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--brand-800);
  padding: 5px 14px 5px 6px;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.user-chip::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b3f1d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E") center / 15px no-repeat,
    var(--brand-100);
}

button.user-chip {
  cursor: pointer;
}

button.user-chip:hover {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.content {
  padding: 24px 28px 48px;
  width: min(100%, 1600px);
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-top: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 16px;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand-600);
}

.metrics > .metric-card:nth-child(4n + 2)::before {
  background: var(--saffron-500);
}

.metrics > .metric-card:nth-child(4n + 3)::before {
  background: #2f8f5b;
}

.metrics > .metric-card:nth-child(4n + 4)::before {
  background: #3f74b5;
}

.reports-metrics .metric-card {
  padding: 14px 16px 12px;
}

.metric-label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: var(--text-2xl);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.reports-metrics .metric-label {
  font-size: 11.5px;
}

.reports-metrics .metric-value {
  font-size: 24px;
}

.reports-metrics .metric-note {
  font-size: var(--text-xs);
}

.activity-report-metrics {
  margin-top: 12px;
}

.report-activity-filters {
  margin-top: 12px;
}

.report-picker-results {
  max-height: 220px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.panel-header h2 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.panel-body {
  padding: 18px 20px 20px;
}

.panel-body > p:first-child {
  margin-top: 0;
  padding-top: 0;
}

.panel-body > p {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.panel-body > p:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Buttons ------------------------------------------------------------------ */

.button,
.icon-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 14.5px;
}

.button {
  border: 1px solid var(--brand-700);
  background: var(--brand-700);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(66, 31, 12, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.button:hover {
  background: var(--brand-800);
  border-color: var(--brand-800);
}

.button.secondary {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--brand-800);
  box-shadow: var(--shadow-xs);
}

.button.secondary:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button.danger:hover {
  background: #931c13;
  border-color: #931c13;
}

.icon-button {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--brand-800);
  box-shadow: var(--shadow-xs);
}

.icon-button:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.button:active,
.icon-button:active,
.small-button:active {
  transform: translateY(1px);
}

.small-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--brand-800);
  padding: 6px 12px;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.small-button:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.small-button.danger {
  border-color: var(--danger-line);
  color: var(--danger);
}

.small-button.danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.button:focus-visible,
.icon-button:focus-visible,
.small-button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.button:disabled,
.icon-button:disabled,
.small-button:disabled,
.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.row-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Fields ------------------------------------------------------------------- */

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field span,
.check-field span {
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--panel);
  color: var(--ink);
  padding: 9px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.field input[type="checkbox"],
.field input[type="radio"] {
  width: 18px;
  min-height: 0;
  height: 18px;
  padding: 0;
}

.field select {
  padding-right: 34px;
}

.field input:hover:not(:focus):not(:disabled),
.field select:hover:not(:focus):not(:disabled) {
  border-color: var(--brand-300);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-500);
  outline: none;
  box-shadow: var(--ring);
}

.compact-field {
  min-width: min(320px, 100%);
}

.wide-field {
  grid-column: 1 / -1;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.check-field input {
  width: 18px;
  height: 18px;
}

/* Tables ------------------------------------------------------------------- */

.table-wrap {
  overflow: auto;
  max-height: min(72vh, 820px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-wrap > table {
  border: 0;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 14px;
}

table.warehouse-report-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 10px;
}

table.warehouse-daywise-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 10px;
}

.warehouse-report-wrap {
  overflow-x: visible;
}

.warehouse-daywise-wrap {
  overflow-x: auto;
}

.activity-report-wrap {
  overflow-x: auto;
}

.warehouse-report-table th,
.warehouse-report-table td {
  padding: 5px 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.warehouse-report-table th {
  font-size: 10px;
  line-height: 1.15;
}

.warehouse-report-table td {
  font-size: 10px;
  line-height: 1.2;
}

.warehouse-daywise-table th,
.warehouse-daywise-table td {
  padding: 5px 4px;
  font-size: 10px;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.warehouse-daywise-table th {
  vertical-align: middle;
}

.activity-report-table {
  min-width: 1600px;
  table-layout: fixed;
}

.activity-report-table th,
.activity-report-table td {
  padding: 8px 6px;
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-report-table th {
  vertical-align: middle;
}

.mini-grid {
  display: grid;
  gap: 4px;
  font-size: 10px;
  line-height: 1.25;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--panel-tint);
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}

.warehouse-report-table th,
.warehouse-daywise-table th,
.activity-report-table th {
  white-space: normal;
  letter-spacing: 0.02em;
}

.table-wrap > table:not(.warehouse-report-table, .warehouse-daywise-table, .activity-report-table) > tbody > tr > td:first-child {
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(even) td {
  background: #fdfaf6;
}

tbody tr:hover td {
  background: var(--brand-50);
}

td strong {
  color: var(--ink);
  font-weight: 650;
}

.worth-row td,
tbody tr.worth-row:nth-child(even) td,
tbody tr.worth-row:hover td {
  background: var(--saffron-100);
  color: var(--brand-900);
  font-weight: 700;
}

.worth-row td strong {
  color: var(--brand-900);
}

/* Status badges ------------------------------------------------------------ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: var(--radius-pill);
  padding: 3px 10px 3px 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  background: var(--brand-50);
  color: var(--brand-800);
  border: 1px solid var(--brand-200);
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.status.good {
  background: var(--success-bg);
  border-color: var(--success-line);
  color: var(--success);
}

.status.warn {
  background: var(--warning-bg);
  border-color: var(--warning-line);
  color: var(--warning);
}

.status.bad {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}

/* Empty / loading / toast -------------------------------------------------- */

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  padding: 28px 20px;
  text-align: center;
  background: var(--panel-soft);
  font-size: 14px;
}

.empty-state::before {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ad6a3b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5V5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2z'/%3E%3Cpath d='M8 7h7'/%3E%3C/svg%3E") center / 18px no-repeat,
    var(--brand-100);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: rgba(44, 19, 7, 0.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 20;
}

.loading-overlay.hidden {
  display: none;
}

.loading-overlay > span {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-900);
  font-weight: 650;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.loading-overlay > .loader {
  width: 42px;
  height: 42px;
  border-width: 4px;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.9);
}

.loading-card {
  min-width: 240px;
  max-width: min(92vw, 420px);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
  color: var(--brand-900);
  font-weight: 650;
  text-align: center;
}

.loading-card span {
  white-space: pre-line;
  line-height: 1.45;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 80;
  pointer-events: none;
}

.toast {
  width: min(380px, calc(100vw - 32px));
  border-radius: var(--radius-md);
  background: var(--brand-950);
  color: #fff6ea;
  padding: 12px 16px 12px 14px;
  border-left: 4px solid var(--saffron-500);
  box-shadow: var(--shadow-strong);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 0.22s var(--ease);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.hide {
  opacity: 0;
  transform: translateY(8px);
}

/* Modals ------------------------------------------------------------------- */

.modal-root {
  position: relative;
  z-index: 40;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 19, 7, 0.46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-strong);
}

.wide-modal {
  width: min(940px, calc(100vw - 32px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
}

.modal-header .icon-button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--text-sm);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 1 / -1;
  padding-top: 4px;
}

.modal .form-actions {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-card .form-actions {
  border-top: 0;
}

.section-gap {
  margin-top: 18px;
}

.compact-header {
  padding-bottom: 10px;
}

.line-editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0 10px;
  background: var(--panel);
}

.line-editor-header h3 {
  margin: 0;
  font-size: var(--text-md);
}

.line-table {
  display: grid;
  gap: 10px;
}

.line-table.scroll-lines {
  max-height: 50vh;
  overflow: auto;
  padding-right: 4px;
}

.document-catalog {
  display: grid;
  gap: 16px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 4px;
}

.document-catalog-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  overflow: hidden;
}

.document-catalog-group h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-50);
  color: var(--brand-900);
  font-size: var(--text-md);
}

.document-catalog-list {
  display: grid;
}

.document-catalog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.document-catalog-row:last-child {
  border-bottom: 0;
}

.document-catalog-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.document-catalog-info strong {
  overflow-wrap: anywhere;
}

.document-catalog-info small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.document-catalog-qty {
  display: grid;
  grid-template-columns: 34px 72px 34px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.document-catalog-qty input {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(90px, 0.2fr) auto;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--panel-soft);
}

.purchase-line-row {
  grid-template-columns: minmax(120px, 0.75fr) minmax(220px, 1.4fr) minmax(120px, 0.8fr) minmax(90px, 0.35fr) minmax(110px, 0.5fr) minmax(110px, 0.5fr) auto;
}

.book-picker {
  display: grid;
  grid-template-columns: minmax(160px, 0.4fr) minmax(220px, 1fr);
  gap: 8px 10px;
  align-items: end;
}

.compact-line-group {
  min-width: min(180px, 100%);
}

.book-picker-results,
.book-picker-selected {
  grid-column: 1 / -1;
}

.qty-field {
  min-width: 84px;
}

.book-picker-results {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.book-picker-item {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.book-picker-item:hover,
.book-picker-item.selected {
  border-color: var(--brand-300);
  background: var(--brand-50);
}

.book-picker-item.selected {
  box-shadow: inset 3px 0 0 var(--brand-600);
}

.book-picker-name {
  font-weight: 650;
}

.book-picker-meta,
.book-picker-selected {
  color: var(--muted);
  font-size: var(--text-xs);
}

.book-picker-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 10px;
  text-align: center;
  font-size: var(--text-sm);
}

.line-remove {
  min-height: 42px;
}

.detail-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.mobile-only {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

  .loader {
    animation-duration: 1.6s !important;
  }
}

@media (max-width: 1180px) and (min-width: 981px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease), box-shadow 0.22s ease;
    z-index: 10;
    box-shadow: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: min(290px, 84vw);
    padding: 18px 12px 24px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-100%);
  }

  .sidebar.open,
  .app-shell.sidebar-collapsed .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(44, 19, 7, 0.38), 18px 0 40px rgba(0, 0, 0, 0.25);
  }

  .mobile-only {
    display: inline-flex;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

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

  .two-col {
    grid-template-columns: 1fr;
  }

  .content {
    max-width: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .line-row {
    grid-template-columns: 1fr;
  }

  .book-picker {
    grid-template-columns: 1fr;
  }

  .purchase-line-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 10px 16px;
    min-height: 64px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar p {
    font-size: 12.5px;
  }

  .content {
    padding: 16px 14px 36px;
  }

  .panel-header,
  .panel-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .form-grid {
    padding: 16px;
    gap: 12px;
  }

  .line-row {
    padding: 12px;
  }

  .table-wrap {
    margin-right: 0;
    max-height: 70vh;
  }
}

@media (max-width: 640px) {
  .user-chip {
    display: none;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .button,
  .button.secondary,
  .icon-button,
  .small-button {
    width: 100%;
    justify-content: center;
  }

  /* Keep compact controls compact in bars, headers and table rows. */
  .topbar .icon-button,
  .topbar .small-button,
  .modal-header .icon-button,
  td .small-button,
  td .button,
  .test-side-menu-header .icon-button {
    width: auto;
  }

  .topbar {
    gap: 10px;
  }

  .topbar p {
    display: none;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions > * {
    flex: 1 1 100%;
  }

  td .row-actions {
    width: auto;
    flex-wrap: nowrap;
  }

  td .row-actions > * {
    flex: 0 0 auto;
  }

  .compact-field {
    min-width: 100%;
  }

  .field input,
  .field select {
    min-height: 44px;
    font-size: 16px;
  }

  .metric-card {
    padding: 14px 14px 12px;
  }

  .metric-value {
    font-size: 21px;
  }

  .metric-note {
    font-size: 12px;
  }

  .modal,
  .wide-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 14px 16px;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    top: max(12px, env(safe-area-inset-top));
    bottom: auto;
    justify-items: center;
  }

  .toast {
    width: 100%;
  }

  .warehouse-report-table,
  .warehouse-daywise-table {
    font-size: 9px;
  }

  .warehouse-report-table th,
  .warehouse-report-table td,
  .warehouse-daywise-table th,
  .warehouse-daywise-table td {
    padding: 4px 3px;
    font-size: 9px;
  }

  .payment-modal {
    padding:
      max(12px, env(safe-area-inset-top))
      12px
      max(20px, calc(env(safe-area-inset-bottom) + 16px));
  }

  .payment-card {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .panel-header .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-header .row-actions > .button {
    grid-column: 1 / -1;
  }

  .panel-header .row-actions > .small-button {
    white-space: normal;
    min-height: 38px;
  }
}

@media (max-width: 340px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media print {
  .sidebar,
  .topbar,
  .toast-stack,
  .loading-overlay {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .table-wrap thead {
    position: static;
  }
}

/* ==========================================================================
   Public / mobile apps
   ========================================================================== */

body.public-mode {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(900px 480px at -10% -8%, rgba(238, 154, 44, 0.16), transparent 62%),
    radial-gradient(760px 420px at 112% -4%, rgba(123, 63, 29, 0.1), transparent 60%),
    linear-gradient(180deg, #fdf8f1 0%, #f7ecdd 100%);
  background-color: #f9f1e6;
  color: var(--ink);
}

body.public-mode .loading-overlay {
  z-index: 60;
}

.public-root {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
  padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 32px));
}

.public-shell {
  display: grid;
  gap: 16px;
}

.public-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(251, 208, 142, 0.3), transparent 70%),
    linear-gradient(135deg, var(--brand-800) 0%, var(--brand-700) 48%, #a8612b 100%);
  color: #fff7ef;
  border: 1px solid rgba(66, 31, 12, 0.2);
  box-shadow: 0 14px 34px rgba(66, 31, 12, 0.18);
}

.public-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.public-hero > * {
  position: relative;
  z-index: 1;
}

.public-hero .public-tag {
  background: rgba(255, 255, 255, 0.16);
  color: #ffeccc;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.public-hero .segment {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff4e6;
}

.public-hero .segment:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.public-hero .segment.active,
.public-hero .segment.active:hover {
  background: var(--saffron-300);
  border-color: var(--saffron-300);
  color: var(--brand-950);
}

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

.public-mark {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--saffron-300) url("/assets/srila-prabhupada-thumb.jpg") center 22% / cover no-repeat;
  color: transparent;
  font-size: 0;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 0 0 3px rgba(255, 236, 204, 0.85), 0 10px 22px rgba(44, 19, 7, 0.28);
}

.public-title {
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.public-subtitle {
  margin-top: 6px;
  color: rgba(255, 244, 230, 0.88);
  font-size: 14px;
  line-height: 1.45;
}

.public-card {
  background: rgba(255, 253, 250, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 2px rgba(66, 31, 12, 0.04), 0 8px 24px rgba(66, 31, 12, 0.06);
  padding: 20px;
}

.public-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.public-card-header h2,
.public-card h1,
.public-card h3 {
  margin: 0;
  color: var(--brand-900);
  letter-spacing: -0.015em;
}

.public-card-header h2 {
  font-size: var(--text-xl);
}

.public-card h1 {
  font-size: clamp(22px, 3vw, 28px);
}

.public-card > p {
  color: var(--muted);
}

.public-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.public-form {
  display: grid;
  gap: 16px;
}

.segmented {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segment {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--brand-800);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-weight: 650;
  cursor: pointer;
}

.segment:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.segment.active,
.segment.active:hover {
  background: var(--brand-700);
  color: #fffaf3;
  border-color: var(--brand-700);
}

.segment:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

body.public-mode .button,
body.public-mode .segment,
body.public-mode .icon-button,
body.public-mode .small-button,
body.public-mode .payment-method-button,
body.public-mode .qty-step-button {
  letter-spacing: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

body.public-mode .button {
  min-height: 44px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
}

body.public-mode .button:not(.secondary) {
  box-shadow: 0 1px 2px rgba(66, 31, 12, 0.2), 0 6px 14px rgba(123, 63, 29, 0.18);
}

body.public-mode .button:active,
body.public-mode .segment:active,
body.public-mode .payment-method-button:active,
body.public-mode .qty-step-button:active {
  transform: scale(0.98);
}

.grid-two,
.grid-three {
  display: grid;
  gap: 14px;
}

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

.grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hint {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 6px;
}

.empty-note {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

.picker-shell {
  display: grid;
  gap: 10px;
}

.picker-shell input[type="search"] {
  min-height: 48px;
}

.selected-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--brand-50);
  color: var(--brand-900);
  border: 1px solid var(--brand-200);
  box-shadow: inset 3px 0 0 var(--brand-600);
}

.selected-chip strong {
  display: block;
}

.selected-chip span {
  font-size: var(--text-xs);
  color: var(--muted);
}

.chip-clear {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--brand-700);
  cursor: pointer;
}

.chip-clear:hover {
  background: var(--brand-100);
}

.picker-results {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.picker-option {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--panel);
  color: var(--brand-900);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.picker-option:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.picker-option.active {
  background: var(--brand-100);
  border-color: var(--brand-300);
}

.picker-option span {
  display: block;
  font-weight: 650;
}

.picker-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 16px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--brand-900);
  font-weight: 600;
  cursor: pointer;
}

.radio-row label:has(input:checked) {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.radio-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.public-actions {
  justify-content: flex-start;
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  justify-items: center;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding:
    max(20px, env(safe-area-inset-top))
    20px
    max(28px, calc(env(safe-area-inset-bottom) + 20px));
}

.payment-card {
  width: min(100%, 560px);
  max-height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
}

.payment-method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.payment-method-button {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--brand-800);
  font-weight: 700;
  cursor: pointer;
}

.payment-method-button:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

.payment-method-button.active,
.payment-method-button.active:hover {
  background: var(--brand-700);
  color: #fff;
  border-color: var(--brand-700);
  box-shadow: 0 6px 16px rgba(123, 63, 29, 0.24);
}

.payment-qr-card,
.payment-summary-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  padding: 14px 16px;
}

.payment-summary-card {
  display: grid;
  gap: 8px;
  color: var(--ink-2);
  font-weight: 500;
}

.payment-summary-card strong {
  color: var(--brand-900);
}

.submitted-payment-summary {
  max-width: 380px;
  margin: 0 auto 18px;
  text-align: left;
}

.payment-qr-image {
  display: block;
  width: min(100%, 320px);
  margin: 0 auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.payment-split-grid {
  margin-top: 16px;
}

.payment-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  font-weight: 650;
}

.success-card {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
  padding: 32px 22px;
}

.success-card > p {
  max-width: 460px;
  margin-inline: auto;
}

.success-card .public-form {
  text-align: left;
  margin-top: 8px;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--saffron-300), var(--saffron-500) 60%, var(--saffron-700));
  color: var(--brand-950);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 0 6px var(--saffron-100), var(--shadow);
}

.success-card .success-meta {
  margin: 14px 0 20px;
  color: var(--muted);
  font-size: var(--text-sm);
}

@media (max-width: 840px) {
  .grid-two,
  .grid-three {
    grid-template-columns: 1fr;
  }

  .payment-method-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .public-title {
    font-size: 21px;
  }

  .public-hero {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .public-card {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .public-card-header h2 {
    font-size: 19px;
  }
}

.request-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.request-main,
.cart-panel {
  min-width: 0;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.catalog-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .catalog-card:hover {
    border-color: var(--brand-200);
    box-shadow: var(--shadow);
  }
}

.catalog-card.sold-out {
  opacity: 0.6;
  filter: saturate(0.6);
}

.catalog-image {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(120px 120px at 30% 20%, rgba(255, 255, 255, 0.6), transparent 70%),
    linear-gradient(160deg, var(--brand-100), var(--brand-200));
  display: grid;
  place-items: center;
}

.catalog-image-button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.catalog-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-viewer-backdrop {
  background: rgba(15, 23, 42, 0.74);
}

.image-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.image-viewer-frame {
  max-width: min(92vw, 1100px);
  max-height: calc(100vh - 80px);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.image-viewer-frame img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: calc(100vh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.image-viewer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 61;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.catalog-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
  color: var(--brand-600);
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.catalog-body {
  display: grid;
  gap: 8px;
  padding: 0 2px 2px;
}

.catalog-name {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.catalog-meta {
  font-size: var(--text-xs);
  color: var(--muted);
}

.catalog-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  color: var(--brand-800);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.catalog-actions {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.catalog-actions input {
  min-height: 44px;
  width: 100%;
  text-align: center;
  font-weight: 650;
}

.cart-panel {
  position: sticky;
  top: 18px;
}

.cart-summary {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--saffron-100), var(--brand-100));
  color: var(--brand-900);
  border: 1px solid var(--brand-200);
  font-variant-numeric: tabular-nums;
}

.cart-items {
  display: grid;
  gap: 10px;
}

.cart-row {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line);
}

.cart-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-row-actions input {
  width: 88px;
  min-height: 42px;
  text-align: center;
  font-weight: 650;
}

@media (max-width: 980px) {
  .request-layout {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

.public-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.floating-request-actions {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  z-index: 20;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.85);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(66, 31, 12, 0.08);
}

.floating-request-actions .segment {
  flex: 0 0 auto;
  border-color: var(--line);
  background: var(--panel);
  color: var(--brand-800);
  box-shadow: none;
}

.floating-request-actions .segment:hover {
  background: var(--brand-50);
}

.floating-request-actions .segment.active {
  background: var(--brand-700);
  color: #fffaf0;
  border-color: var(--brand-700);
  box-shadow: 0 4px 12px rgba(123, 63, 29, 0.25);
}

.floating-request-actions .request-nav-tab.request-nav-active,
.floating-request-actions .request-nav-tab[aria-pressed="true"] {
  background: var(--brand-800) !important;
  color: #fffaf0 !important;
  border-color: var(--brand-800) !important;
  box-shadow: 0 4px 12px rgba(93, 45, 19, 0.3) !important;
}

.category-switch-card {
  padding: 16px 18px;
}

.category-inline-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
}

.compact-header {
  margin-bottom: 10px;
}

.category-segmented {
  width: 100%;
}

.catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 12px;
  align-items: end;
}

.compact-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.compact-card {
  padding: 10px;
  gap: 8px;
}

.compact-image {
  aspect-ratio: 0.9 / 1;
}

.small-name {
  font-size: 15px;
}

.compact-stats {
  font-size: 12px;
}

.compact-actions {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
}

.compact-actions input {
  min-height: 38px;
  padding: 8px 10px;
}

.checkout-actions,
.centered-actions,
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.checkout-actions > .button,
.checkout-actions > .button.secondary {
  flex: 1 1 220px;
}

.centered-actions {
  justify-content: center;
}

.mobile-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.success-inline {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-line);
  font-size: 14px;
  font-weight: 500;
}

.request-activity-fields {
  align-items: stretch;
}

.activity-help-card {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 74px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--brand-300);
  background: var(--brand-50);
  color: var(--brand-900);
}

.activity-help-card strong {
  font-size: 15px;
}

.activity-help-card span {
  color: var(--muted);
  font-size: 13px;
}

.compact-summary {
  margin-bottom: 16px;
}

.history-lookup {
  margin-bottom: 18px;
}

.history-table-wrap,
.history-detail-table-wrap {
  overflow-x: auto;
}

.history-table,
.history-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td,
.history-detail-table th,
.history-detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.history-table th,
.history-detail-table th {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-detail-row td {
  background: var(--panel-tint);
}

.history-detail-card {
  display: grid;
  gap: 12px;
}

.history-activity-list {
  display: grid;
  gap: 14px;
}

.history-activity-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.history-activity-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-tint);
}

.history-activity-header h3 {
  margin: 0;
  color: var(--brand-900);
  font-size: 17px;
}

.history-activity-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-request-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.history-request-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.history-request-main,
.history-request-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.history-request-main strong {
  color: var(--brand-900);
  font-size: 15px;
}

.history-request-main span,
.history-request-meta {
  color: var(--muted);
  font-size: 13px;
}

.history-request-status {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  background: var(--success-bg);
  border: 1px solid var(--success-line);
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
}

@media (max-width: 980px) {
  .catalog-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .floating-request-actions {
    width: auto;
    margin-left: 0;
    justify-content: stretch;
    gap: 6px;
    margin-bottom: 12px;
  }

  .floating-request-actions .segment {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    min-height: 44px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-inline: 14px;
  }

  .public-top-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .checkout-actions {
    flex-wrap: nowrap;
  }

  .checkout-actions > .button,
  .checkout-actions > .button.secondary {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: 10px;
  }

  .catalog-body {
    gap: 6px;
  }

  .small-name {
    font-size: 14px;
  }

  .compact-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .mobile-lookup-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .floating-request-actions .segment {
    flex-basis: calc(50% - 5px);
    font-size: 14px;
    padding-inline: 12px;
  }

  .compact-grid {
    gap: 10px;
  }

  .compact-actions {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .compact-actions .button,
  .compact-actions .small-button {
    padding-inline: 10px;
    min-height: 38px;
  }
}

#testRoot {
  display: grid;
  gap: 16px;
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px));
}

/* Let wide tables scroll inside their card instead of stretching the page. */
#testRoot > *,
#testRoot .activity-list > *,
#testRoot .test-sale-list > *,
.public-shell > *,
.request-main > * {
  min-width: 0;
}

.catalog-toolbar + .empty-note,
.catalog-toolbar + .empty-state {
  margin-top: 14px;
}

.catalog-grid > .empty-state,
.catalog-grid > .empty-note {
  grid-column: 1 / -1;
}

#testRoot .split-row > .button,
#testRoot .split-row > .small-button {
  width: auto;
  flex: 0 0 auto;
}

#testRoot .test-hero {
  display: grid;
  gap: 10px;
  justify-content: stretch;
  align-items: start;
  padding: 24px 22px 26px;
}

#testRoot .test-hero .public-tag {
  justify-self: start;
}

#testRoot .test-hero h1,
#testRoot .test-app-header h1 {
  margin: 0;
  font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: inherit;
}

#testRoot .test-hero p {
  max-width: 680px;
  margin: 0;
  color: rgba(255, 244, 230, 0.9);
  line-height: 1.5;
}

#testRoot .test-app-header {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(360px 200px at 100% 0%, rgba(251, 208, 142, 0.32), transparent 70%),
    linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 55%, #a8612b 100%);
  color: #fff8ef;
  box-shadow: 0 12px 30px rgba(66, 31, 12, 0.2);
}

#testRoot .test-app-header h1 {
  font-size: clamp(20px, 2.6vw, 28px);
}

#testRoot .test-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#testRoot .test-menu-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 248, 236, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 248, 236, 0.14);
  color: #fff8ef;
  display: grid;
  place-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: background-color 0.15s ease;
}

#testRoot .test-menu-button:hover {
  background: rgba(255, 248, 236, 0.24);
}

#testRoot .test-menu-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(251, 208, 142, 0.6);
}

#testRoot .test-menu-button span {
  width: 21px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

#testRoot .test-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 42;
  border: 0;
  background: rgba(44, 19, 7, 0.42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

#testRoot .test-menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

#testRoot .test-side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 43;
  width: min(320px, calc(100vw - 36px));
  padding:
    max(18px, env(safe-area-inset-top))
    16px
    max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
  box-shadow: 22px 0 46px rgba(44, 19, 7, 0.22);
  transform: translateX(-105%);
  transition: transform 0.22s var(--ease);
}

#testRoot .test-side-menu.open {
  transform: translateX(0);
}

#testRoot .test-side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

#testRoot .test-side-menu-header strong {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--brand-900);
  font-size: 20px;
}

#testRoot .test-side-menu-header strong::before {
  content: "";
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-100) url("/assets/srila-prabhupada-thumb.jpg") center 22% / cover no-repeat;
  box-shadow: 0 0 0 2px var(--saffron-300);
}

#testRoot .test-side-menu-header .icon-button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--text-sm);
}

#testRoot .test-nav {
  display: grid;
  gap: 6px;
  padding-top: 16px;
}

#testRoot .home-devotional-hero {
  height: calc(100svh - 158px);
  min-height: 0;
  display: grid;
  align-items: stretch;
}

#testRoot .home-photo-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(66, 31, 12, 0.16);
  overflow: hidden;
  min-height: 0;
  height: 100%;
  background: #f8ead5;
}

#testRoot .home-photo-wrap img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
  object-position: center 42%;
}

#testRoot .home-quote-mask {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 8px;
  padding: clamp(22px, 4vw, 42px);
  background:
    linear-gradient(180deg, rgba(42, 14, 12, 0), rgba(42, 14, 12, 0.72) 24%, rgba(42, 14, 12, 0.92) 100%);
  color: #fff7e6;
}

#testRoot .home-quote-mask blockquote {
  margin: 0;
  max-width: 860px;
  color: #fff8e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 2.6vw, 34px);
  line-height: 1.25;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

#testRoot .home-quote-mask p {
  margin: 0;
  color: #ffd98d;
  font-weight: 900;
  font-size: clamp(14px, 1.7vw, 18px);
}

#testRoot .test-nav .segment {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
  border-radius: var(--radius-md);
  border-color: transparent;
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  box-shadow: none;
}

#testRoot .test-nav .segment:hover {
  background: var(--brand-50);
}

#testRoot .test-nav .segment.active {
  background: var(--brand-700);
  color: #fffaf3;
  box-shadow: 0 4px 12px rgba(123, 63, 29, 0.22);
}

#testRoot .test-nav .test-logout-menu {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  color: var(--danger);
}

#testRoot .test-nav .test-logout-menu:hover {
  background: var(--danger-bg);
}

#testRoot .public-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: var(--panel);
  color: var(--ink);
  padding: 11px 14px;
  font-size: 16px;
  outline: none;
  box-shadow: var(--shadow-xs);
}

#testRoot select.public-input {
  padding-right: 36px;
}

#testRoot .public-input:hover:not(:focus) {
  border-color: var(--brand-300);
}

#testRoot .public-input:focus {
  border-color: var(--brand-500);
  box-shadow: var(--ring);
}

#testRoot .sticky-search {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  z-index: 5;
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a8676' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 13px center;
  background-size: 18px;
}

#testRoot .field-label {
  display: block;
  margin: 14px 0 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

#testRoot .wide {
  width: 100%;
  margin-top: 14px;
  min-height: 48px;
}

#testRoot .test-floating-actions {
  top: calc(env(safe-area-inset-top, 0px) + 82px);
  justify-content: flex-end;
}

#testRoot .test-floating-actions .segment {
  min-width: min(100%, 220px);
}

#testRoot .cart-floating-actions {
  position: fixed;
  inset: auto max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) auto;
  z-index: 34;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#testRoot .cart-floating-actions .segment {
  min-width: 0;
  min-height: 48px;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  box-shadow: 0 10px 26px rgba(66, 31, 12, 0.32);
}

#testRoot .reload-floating-actions {
  position: fixed;
  inset: auto auto max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  z-index: 34;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#testRoot .reload-floating-actions .segment,
#testRoot .reload-floating-actions .segment.active {
  min-width: 0;
  min-height: 48px;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  background: var(--panel);
  color: var(--brand-800);
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px rgba(66, 31, 12, 0.18);
}

#testRoot .activity-detail-back-actions {
  position: fixed;
  inset: max(82px, calc(env(safe-area-inset-top) + 74px)) max(14px, env(safe-area-inset-right)) auto auto;
  z-index: 34;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#testRoot .activity-detail-back-actions .segment {
  min-width: 0;
  min-height: 44px;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  box-shadow: 0 8px 22px rgba(66, 31, 12, 0.24);
}

#testRoot .compact-doc-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

#testRoot .compact-doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--brand-900);
  font-size: 13px;
}

#testRoot .compact-doc-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#testRoot .compact-doc-actor {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

#testRoot .report-filter-card {
  padding-block: 16px;
}

#testRoot .report-filter-card h3 {
  margin-bottom: 10px;
}

#testRoot .report-filter-segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

#testRoot .report-filter-segmented .segment {
  min-width: 0;
  min-height: 40px;
  padding: 8px 6px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--brand-800);
  border-color: var(--line-strong);
}

#testRoot .report-filter-segmented .segment.active {
  background: var(--brand-700);
  color: #fffaf0;
  border-color: var(--brand-700);
}

#testRoot .report-activity-card {
  padding-block: 16px;
}

#testRoot .report-activity-metrics,
#testRoot .report-detail-metrics {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

#testRoot .report-payment-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

#testRoot .report-payment-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#testRoot .action-prompt {
  margin: 4px 0 12px;
  color: var(--ink-2);
  font-weight: 700;
}

#testRoot .action-choice-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
}

#testRoot .action-choice-segmented .segment,
#testRoot .category-segmented .segment {
  background: var(--panel);
  color: var(--brand-800);
  border-color: var(--line-strong);
}

#testRoot .action-choice-segmented .segment {
  min-height: 48px;
  border-radius: var(--radius-md);
}

#testRoot .action-choice-segmented .segment.active,
#testRoot .category-segmented .segment.active {
  background: var(--brand-700);
  color: #fffaf0;
  border-color: var(--brand-700);
}

#testRoot .text-only-card {
  min-height: 0;
}

#testRoot .text-only-card .catalog-body {
  gap: 8px;
}

#testRoot .test-catalog-grid {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
}

#testRoot .catalog-card {
  min-width: 0;
  border-radius: var(--radius-lg);
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

#testRoot .catalog-card .button {
  width: 100%;
  min-height: 40px;
}

#testRoot .sale-catalog-card {
  align-content: stretch;
}

#testRoot .sale-catalog-card .catalog-body {
  height: 100%;
}

#testRoot .sale-empty-state {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  font-size: 16px;
  font-weight: 650;
  color: var(--muted);
  background: var(--panel-soft);
}

#testRoot .sale-cart-panel {
  padding-block: 18px;
}

#testRoot .metric-grid > div {
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-200);
  background: linear-gradient(160deg, var(--saffron-100), var(--brand-50));
  box-shadow: none;
}

#testRoot .compact-sale-cart {
  display: grid;
  gap: 8px;
  max-height: 188px;
  overflow-y: auto;
  padding-right: 4px;
}

#testRoot .compact-cart-row {
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  padding: 9px 10px;
}

#testRoot .compact-cart-row strong,
#testRoot .compact-cart-row p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#testRoot .compact-cart-row input {
  width: 82px;
  min-height: 38px;
}

#testRoot .request-qty-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
}

#testRoot .qty-step-button,
#testRoot .request-picker-qty {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--brand-900);
  font-weight: 700;
}

#testRoot .qty-step-button:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}

#testRoot .qty-step-button {
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

#testRoot .request-picker-qty {
  width: 100%;
  padding: 7px 8px;
  text-align: center;
}

#testRoot .test-sale-list,
#testRoot .activity-list {
  display: grid;
  gap: 12px;
}

#testRoot .test-sale-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
}

#testRoot .test-sale-card h3 {
  margin: 0 0 4px;
  color: var(--brand-900);
}

#testRoot .public-card h2 {
  margin: 0;
  color: var(--brand-900);
}

#testRoot .test-sale-card p,
#testRoot .muted {
  margin: 0;
  color: var(--muted);
}

#testRoot .activity-card h2,
#testRoot .activity-card h3 {
  font-size: 18px;
}

#testRoot .split-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

#testRoot .metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

#testRoot .metric-grid > div {
  padding: 10px 12px;
}

#testRoot .metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

#testRoot .metric-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--brand-900);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

#testRoot .qty-input {
  width: 82px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px;
  text-align: center;
  font-weight: 650;
}

#testRoot .button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

#testRoot .button-row .button {
  flex: 1 1 160px;
}

#testRoot .table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

#testRoot .mini-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

#testRoot .mini-table th,
#testRoot .mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

#testRoot .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: start;
  justify-items: center;
  overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  background: rgba(44, 19, 7, 0.55);
}

#testRoot .payment-card {
  width: min(560px, 100%);
  max-height: none;
  border-radius: var(--radius-xl);
  background: var(--panel);
}

@media (min-width: 1180px) {
  #testRoot .test-catalog-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .public-root {
    width: min(100% - 24px, 1120px);
    padding-top: 12px;
  }

  #testRoot .test-app-header {
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
  }

  #testRoot .test-app-header h1 {
    font-size: 19px;
    line-height: 1.2;
  }

  #testRoot .test-hero {
    padding: 20px 18px 22px;
  }

  #testRoot .test-hero h1 {
    font-size: 28px;
  }

  #testRoot .home-photo-wrap,
  #testRoot .home-photo-wrap img {
    min-height: 0;
  }

  #testRoot .home-devotional-hero {
    height: calc(100svh - 132px);
  }

  #testRoot .home-quote-mask {
    padding: 72px 18px 22px;
  }

  #testRoot .home-quote-mask blockquote {
    font-size: 18px;
  }

  #testRoot .test-app-header .small-button {
    min-height: 40px;
    padding-inline: 12px;
  }

  #testRoot .test-floating-actions:not(.cart-floating-actions) {
    top: calc(env(safe-area-inset-top, 0px) + 110px);
  }

  #testRoot .action-choice-segmented {
    grid-template-columns: 1fr;
  }

  #testRoot .test-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #testRoot .catalog-card {
    padding: 9px;
  }

  #testRoot .catalog-image {
    border-radius: 12px;
  }

  #testRoot .catalog-name {
    font-size: 14px;
  }

  #testRoot .catalog-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  #testRoot .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #testRoot .test-sale-card {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 390px) {
  #testRoot .test-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #testRoot .catalog-card {
    padding: 8px;
  }

  #testRoot .catalog-body {
    gap: 6px;
  }
}

/* ===== Admin v3: online payments, notifications, announcements ===== */

.metrics.metrics-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-xs);
  padding: 0 5px;
}

.break-all {
  word-break: break-all;
}

/* Bell in the top bar */
.bell-button {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
}

.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  border: 2px solid var(--panel);
}

/* Notifications drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(44, 19, 7, 0.32);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 16;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-strong);
  animation: drawer-in 0.2s var(--ease);
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.drawer-header h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-header .icon-button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--text-sm);
}

.drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
}

.drawer-loading {
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.notification-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.notification-item.unread {
  background: var(--saffron-100);
  border-color: var(--saffron-300);
  box-shadow: inset 3px 0 0 var(--saffron-500);
}

.notification-open {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.notification-open:focus-visible,
.notification-mark:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.notification-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.notification-type {
  font-weight: 700;
  color: var(--brand-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notification-type.bad {
  color: var(--danger);
}

.notification-item strong {
  font-size: 14.5px;
  line-height: 1.35;
}

.notification-body {
  font-size: var(--text-sm);
  color: var(--ink-2);
  line-height: 1.45;
}

.notification-mark {
  margin: 8px 8px 0 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--brand-700);
  cursor: pointer;
  font-weight: 800;
}

.notification-mark:hover {
  background: var(--brand-50);
}

/* Segmented chips with counts / radios */
.segment-count {
  display: inline-block;
  min-width: 22px;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: var(--text-xs);
  font-weight: 750;
  text-align: center;
}

.segment.active .segment-count {
  background: rgba(255, 250, 243, 0.22);
  color: #fffaf3;
}

.segment-radio {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.segment-radio input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.segment-radio:focus-within {
  box-shadow: var(--ring);
}

.plain-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.plain-fieldset legend {
  padding: 0;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 650;
}

/* Modal content helpers */
.modal-body {
  padding: 18px 20px 4px;
}

.modal-footer {
  padding: 14px 20px 18px;
  margin-top: 16px;
}

.modal-section-title {
  margin: 20px 0 8px;
  font-size: var(--text-md);
  color: var(--ink);
}

.modal-header h2 .status {
  margin-left: 8px;
  vertical-align: middle;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px 18px;
  margin: 0;
}

.kv-item {
  min-width: 0;
}

.kv-item dt {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kv-item dd {
  margin: 2px 0 0;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.kv-grid.single {
  grid-template-columns: 1fr;
  gap: 0;
}

.kv-grid.single .kv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.kv-grid.single .kv-item:last-child {
  border-bottom: 0;
}

.kv-grid.single .kv-item dd {
  margin: 0;
  text-align: right;
}

.callout {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.callout strong {
  color: var(--ink);
  font-size: 14.5px;
}

.callout.bad {
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

.callout.bad strong {
  color: var(--danger);
}

.callout.warn {
  background: var(--warning-bg);
  border-color: var(--warning-line);
}

.callout.warn strong {
  color: var(--warning);
}

.action-panel {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.action-panel h3 {
  margin: 0;
  font-size: var(--text-md);
}

.action-panel .hint {
  margin: 0;
}

.form-grid.compact-form-grid {
  padding: 0;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--brand-500);
  box-shadow: inset 0 0 0 1px var(--brand-500);
}

.choice input {
  margin-top: 3px;
  accent-color: var(--brand-700);
}

.choice span {
  display: grid;
  gap: 2px;
}

.choice small {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.payment-detail-qr {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
}

.payment-detail-qr img {
  width: 148px;
  height: auto;
  border-radius: var(--radius-sm);
  background: #fff;
}

.payment-events {
  margin-top: 14px;
  font-size: var(--text-sm);
}

.payment-events summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--brand-800);
}

.payment-events ul {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

tr.row-attention > td {
  background: #fff7f5;
}

.payments-setup .panel-body h3 {
  margin: 18px 0 8px;
  font-size: var(--text-md);
}

.payments-setup-lead {
  max-width: 760px;
  color: var(--ink-2);
}

.setup-steps {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
  max-width: 900px;
  line-height: 1.55;
  color: var(--ink-2);
}

.setup-steps strong {
  color: var(--ink);
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: var(--text-sm);
}

.reconcile-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.announcements-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: start;
}

@media (max-width: 980px) {
  .announcements-layout {
    grid-template-columns: 1fr;
  }
}

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

  .metrics.metrics-three > .metric-card:last-child {
    grid-column: 1 / -1;
  }

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

  .topbar .bell-button {
    width: 40px;
  }

  .segmented .segment {
    width: auto;
    padding: 8px 12px;
  }

  .drawer-header-actions .small-button {
    width: auto;
  }

  .modal-body {
    padding: 14px 16px 4px;
  }

  .modal-footer {
    padding: 12px 16px 16px;
  }

  .payment-detail-qr {
    flex-direction: column;
    align-items: flex-start;
  }

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

/* ===== i18n language toggle (public pages) ===== */
.lang-toggle.segmented {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--panel);
}

.lang-toggle .segment {
  min-height: 32px;
  padding: 4px 12px;
  border-color: transparent;
  background: transparent;
  font-size: var(--text-sm, 13.5px);
  line-height: 1.2;
  white-space: nowrap;
}

.lang-toggle .segment:hover {
  border-color: transparent;
}

.lang-toggle .segment.active,
.lang-toggle .segment.active:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fffaf3;
}

.public-hero .lang-toggle.segmented,
#testRoot .test-app-header .lang-toggle.segmented {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.public-hero .lang-toggle .segment,
#testRoot .test-app-header .lang-toggle .segment {
  border-color: transparent;
  background: transparent;
  color: #fff4e6;
}

.public-hero .lang-toggle .segment:hover,
#testRoot .test-app-header .lang-toggle .segment:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: transparent;
}

.public-hero .lang-toggle .segment.active,
.public-hero .lang-toggle .segment.active:hover,
#testRoot .test-app-header .lang-toggle .segment.active,
#testRoot .test-app-header .lang-toggle .segment.active:hover {
  background: var(--saffron-300);
  border-color: var(--saffron-300);
  color: var(--brand-950);
}

/* Online classes: standalone bar above the card on success / error screens */
.public-lang-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* Distribution page: tag + toggle row on the login hero, toggle beside the profile title and in the side menu */
#testRoot .test-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#testRoot .test-profile-header {
  flex-wrap: wrap;
}

#testRoot .test-menu-lang {
  padding-top: 14px;
}

#testRoot .test-app-header .test-header-main {
  flex: 1 1 auto;
}

/* Telugu glyphs need a little more room: no negative tracking, looser heading leading */
html[lang="te"] body.public-mode .public-title,
html[lang="te"] body.public-mode .public-card h1,
html[lang="te"] body.public-mode .public-card h2,
html[lang="te"] body.public-mode .public-card h3,
html[lang="te"] body.public-mode #testRoot .test-hero h1,
html[lang="te"] body.public-mode #testRoot .test-app-header h1 {
  letter-spacing: 0;
  line-height: 1.3;
}

@media (max-width: 760px) {
  /* The side menu carries the toggle on phones; keep the compact header uncluttered. */
  #testRoot .test-app-header .test-header-lang {
    display: none;
  }

  .public-hero .lang-toggle .segment {
    padding-inline: 10px;
  }
}

/* /request: WhatsApp OTP login for lookups by mobile number */
.otp-login {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--brand-50);
}

.otp-login-intro {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm, 14px);
  line-height: 1.5;
}

.otp-login .otp-actions,
.history-lookup .otp-actions {
  margin: 0;
}

.otp-login .otp-actions .button {
  width: 100%;
}

.otp-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.otp-links .button {
  flex: 1 1 140px;
}

.otp-skip {
  display: flex;
  justify-content: center;
}

.otp-session-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 12px);
  background: var(--brand-50);
  color: var(--brand-900);
  font-weight: 650;
  margin-bottom: 12px;
}

/* Longer (Telugu) tags wrap under the heading instead of squeezing it */
body.public-mode .public-card-header {
  flex-wrap: wrap;
}

/* ==========================================================================
   Admin: barcodes, QR labels, sankirtan, system health, reminders (2026-10)
   ========================================================================== */

.select-col {
  width: 38px;
  text-align: center !important;
}

.select-col input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand-600);
  cursor: pointer;
}

.barcode-col {
  white-space: nowrap;
}

.barcode-col .barcode-link-button {
  margin-left: 6px;
  min-height: 30px;
  padding: 4px 10px;
  font-size: var(--text-xs);
}

.barcode-value {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.label-toolbar-actions {
  margin-left: auto;
}

.not-available-note {
  margin: 0 0 12px;
  color: var(--subtle);
  font-style: italic;
}

.barcode-item-summary {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.barcode-modal #barcodeDialogInput {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.barcode-modal .callout {
  margin-bottom: 0;
}

.button.secondary.danger-text {
  color: var(--danger);
  margin-right: auto;
}

.barcode-setup-help {
  margin-top: 0;
}

.barcode-errors span {
  display: block;
}

table.barcode-setup-table {
  min-width: 760px;
}

.barcode-input-col {
  min-width: 220px;
}

.barcode-scan-input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  color: var(--ink);
}

.barcode-scan-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--ring);
  background: var(--saffron-100);
}

.barcode-scan-input.saving {
  opacity: 0.6;
}

.barcode-row-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 650;
}

/* QR label sheets: on screen a preview overlay, on paper only the sheets. */
.label-print-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: auto;
  background: #e9e3db;
  padding: 0 0 32px;
}

.label-print-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.label-print-title {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.label-print-title span {
  color: var(--muted);
  font-size: var(--text-sm);
}

.label-print-toolbar .compact-field input {
  width: 96px;
}

.label-print-hint {
  flex-basis: 100%;
  margin: 0;
}

.label-sheets {
  display: grid;
  justify-content: center;
  gap: 18px;
  padding: 18px 8px;
}

.label-sheet {
  box-sizing: border-box;
  width: 210mm;
  height: 297mm;
  padding: 0.5mm 0;
  display: grid;
  grid-template-columns: repeat(3, 70mm);
  grid-template-rows: repeat(8, 37mm);
  overflow: hidden;
  background: #fff;
  color: #000;
  box-shadow: var(--shadow);
}

.qr-label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 2.5mm;
  width: 70mm;
  height: 37mm;
  padding: 3mm 3mm 3mm 3.5mm;
  overflow: hidden;
  outline: 1px dashed #d8cfc4;
  outline-offset: -1px;
  font-family: Arial, "Helvetica Neue", "Noto Sans", "Nirmala UI", sans-serif;
}

.qr-label-code {
  flex: 0 0 28mm;
  width: 28mm;
  height: 28mm;
}

.qr-label-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-label-text {
  display: flex;
  flex-direction: column;
  gap: 1mm;
  min-width: 0;
}

.qr-label-erp {
  font-size: 9.5pt;
  letter-spacing: 0.02em;
}

.qr-label-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 7.5pt;
  line-height: 1.2;
}

.qr-label-price {
  font-size: 11pt;
}

@media screen and (max-width: 900px) {
  .label-sheet {
    zoom: 0.44;
  }
}

body.label-print-open {
  overflow: hidden;
}

@media print {
  body.label-print-open {
    overflow: visible;
    background: #fff;
  }

  body.label-print-open > *:not(#labelPrintRoot) {
    display: none !important;
  }

  body.label-print-open .label-print-root {
    position: static;
    overflow: visible;
    padding: 0;
    background: #fff;
  }

  body.label-print-open .label-print-toolbar {
    display: none !important;
  }

  body.label-print-open .label-sheets {
    display: block;
    padding: 0;
  }

  body.label-print-open .label-sheet {
    zoom: 1;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  body.label-print-open .label-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.label-print-open .qr-label {
    outline: 0;
  }
}

/* Sankirtan */
.sankirtan-period-text {
  margin-left: 8px;
  font-weight: 600;
}

.sankirtan-custom {
  justify-content: flex-start;
}

.sankirtan-metrics {
  margin-bottom: 16px;
}

table.sankirtan-table {
  min-width: 620px;
}

table.sankirtan-table .num,
table.sankirtan-rules-table .num {
  text-align: right;
}

table.sankirtan-table tfoot th {
  border-top: 2px solid var(--line-strong);
  border-bottom: 0;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 750;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-800);
  font-size: 12px;
  font-weight: 800;
}

.rank-1 .rank-badge,
.sankirtan-top3 li:nth-child(1) .rank-badge {
  background: #fde68a;
  border-color: #f2c94c;
  color: #6b4a00;
}

.rank-2 .rank-badge,
.sankirtan-top3 li:nth-child(2) .rank-badge {
  background: #e5e7eb;
  border-color: #cbd0d6;
  color: #374151;
}

.rank-3 .rank-badge,
.sankirtan-top3 li:nth-child(3) .rank-badge {
  background: #f3d3b5;
  border-color: #e0b088;
  color: #6b3a12;
}

table.sankirtan-rules-table {
  min-width: 560px;
}

.sankirtan-rules-table input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

.sankirtan-rules-table .rule-points-input {
  max-width: 110px;
  text-align: right;
}

.sankirtan-rules-table .row-actions.nowrap {
  flex-wrap: nowrap;
}

.sankirtan-rules-table .rule-default-row td {
  background: var(--panel-soft);
}

.sankirtan-rules-actions {
  padding: 14px 0 0;
}

.sankirtan-dashboard-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}

.sankirtan-dashboard-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.sankirtan-dashboard-totals > div {
  display: grid;
  gap: 2px;
}

.sankirtan-dashboard-totals strong {
  font-size: var(--text-xl);
  color: var(--ink);
}

.sankirtan-top3 {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sankirtan-top3 li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

/* System health + alerts */
.health-kv .kv-item dd {
  max-width: 70%;
}

.health-nested {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.health-nested .health-kv {
  min-width: 220px;
  font-size: var(--text-sm);
}

.health-nested .health-kv .kv-item {
  padding: 4px 0;
}

.health-list {
  margin: 0;
  text-align: left;
  font-size: var(--text-sm);
}

.alert-list {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.alert-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--danger-line);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  background: var(--panel);
}

.alert-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.alert-item-head .metric-note {
  margin-left: auto;
}

.alert-item-body {
  margin: 0;
}

.alert-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Reminders switches (Settings) */
.reminders-form {
  display: grid;
  gap: 4px;
}

.switch-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  flex: 0 0 42px;
  position: relative;
  width: 42px;
  height: 24px;
  margin-top: 2px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: background 0.15s var(--ease);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s var(--ease);
}

.switch-row input:checked + .switch-track {
  background: var(--success);
}

.switch-row input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch-row input:focus-visible + .switch-track {
  box-shadow: var(--ring);
}

.switch-text {
  display: grid;
  gap: 2px;
}

.switch-text .hint {
  margin: 0;
}

.reminders-threshold {
  margin-top: 12px;
  max-width: 260px;
}

@media (max-width: 640px) {
  .label-toolbar-actions {
    margin-left: 0;
  }

  .health-kv .kv-item {
    flex-wrap: wrap;
  }

  .health-kv .kv-item dd {
    max-width: 100%;
  }

  .health-nested {
    justify-items: start;
  }
}

/* ==========================================================================
   /testdistribution customer receipt (80 mm-friendly)
   ========================================================================== */

#testRoot .compact-doc-row:has(.receipt-doc-button) {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

#testRoot .receipt-doc-button {
  min-height: 30px;
  padding: 4px 10px;
}

.receipt-ready-card .split-row {
  flex-wrap: wrap;
  gap: 10px;
}

.receipt-ready-card .muted {
  margin: 4px 0 0;
}

#testRoot .receipt-ready-actions {
  flex-wrap: nowrap;
  margin-top: 0;
}

#testRoot .receipt-ready-actions .button {
  flex: 0 0 auto;
  width: auto;
}

body.receipt-open {
  overflow: hidden;
}

.receipt-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgba(44, 19, 7, 0.55);
}

.receipt-toolbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.receipt-toolbar .button {
  flex: 0 1 140px;
  width: auto;
  min-width: 0;
}

.receipt-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.receipt-paper {
  box-sizing: border-box;
  width: min(80mm, 100%);
  margin: 0 auto;
  padding: 5mm 4mm;
  background: #fff;
  color: #000;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.35;
  box-shadow: var(--shadow-strong);
}

.receipt-paper .rc-head {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding-bottom: 3mm;
  border-bottom: 1px dashed #000;
  text-align: center;
}

.receipt-paper .rc-org {
  font-size: 14px;
  line-height: 1.25;
}

.receipt-paper .rc-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.receipt-paper .rc-meta {
  display: grid;
  gap: 1mm;
  margin: 3mm 0;
}

.receipt-paper .rc-meta div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.receipt-paper .rc-meta dt {
  color: #333;
}

.receipt-paper .rc-meta dd {
  margin: 0;
  text-align: right;
  font-weight: 650;
  word-break: break-word;
}

.receipt-paper table.rc-lines {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: transparent;
  font-size: 12px;
}

.receipt-paper .rc-lines th,
.receipt-paper .rc-lines td {
  padding: 1.2mm 0.8mm;
  border: 0;
  background: transparent;
  color: #000;
  vertical-align: top;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: none;
  white-space: normal;
}

.receipt-paper .rc-lines thead th {
  border-top: 1px dashed #000;
  border-bottom: 1px dashed #000;
  font-size: 11px;
  font-weight: 700;
}

.receipt-paper .rc-lines .rc-num {
  text-align: right;
  white-space: nowrap;
}

.receipt-paper .rc-lines .rc-item {
  text-align: left;
  word-break: break-word;
}

.receipt-paper .rc-total,
.receipt-paper .rc-pay {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.receipt-paper .rc-total {
  margin-top: 1mm;
  padding: 2mm 0;
  border-top: 1px dashed #000;
  font-size: 15px;
}

.receipt-paper .rc-pay {
  padding-bottom: 3mm;
  border-bottom: 1px dashed #000;
}

.receipt-paper .rc-pay strong {
  text-align: right;
}

.receipt-paper .rc-foot {
  padding-top: 3mm;
  text-align: center;
  font-weight: 700;
}

@media print {
  body.receipt-open {
    overflow: visible;
    background: #fff !important;
  }

  body.receipt-open > *:not(#receiptRoot) {
    display: none !important;
  }

  body.receipt-open .receipt-root {
    position: static;
    display: block;
    background: #fff;
  }

  body.receipt-open .receipt-toolbar {
    display: none !important;
  }

  body.receipt-open .receipt-scroll {
    overflow: visible;
    padding: 0;
  }

  body.receipt-open .receipt-paper {
    width: 72mm;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
}

/* Cash handover & UPI verification (admin + /testdistribution) ------------- */

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--saffron-500);
  color: var(--brand-950);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.nav-badge.hidden {
  display: none;
}

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

td.nowrap,
.nowrap {
  white-space: nowrap;
}

tr.row-muted > td {
  color: var(--subtle);
}

tr.row-selected > td {
  background: var(--brand-50);
}

tr.row-good > td {
  background: var(--success-bg);
}

.recon-desc {
  min-width: 220px;
  max-width: 420px;
  word-break: break-word;
}

.recon-upload-toolbar .compact-field input[type="file"] {
  max-width: 320px;
}

.recon-mapping {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
}

.recon-mapping .callout {
  margin-bottom: 0;
}

.recon-mapping-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
}

.recon-mapping-head h3 {
  margin: 0;
  font-size: var(--text-md);
  word-break: break-all;
}

.recon-header-row-field input {
  width: 90px;
}

.recon-mapping-source {
  align-self: end;
  padding-bottom: 10px;
}

.recon-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.recon-map-grid .field select {
  width: 100%;
}

.recon-preview-summary,
.recon-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.recon-preview-summary > div,
.recon-result-grid > div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.recon-preview-summary strong,
.recon-result-grid strong {
  font-variant-numeric: tabular-nums;
}

.recon-preview-table {
  max-height: 420px;
  overflow: auto;
}

.recon-result {
  background: var(--success-bg);
  border-color: var(--success-line);
}

.recon-skipped summary,
.legacy-entries summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 650;
}

.recon-skipped ul,
.legacy-entries ul {
  margin-top: 8px;
}

.recon-match-modal .modal-body {
  display: grid;
  gap: 14px;
  padding-bottom: 20px;
}

.recon-match-modal .callout {
  margin-bottom: 0;
}

.match-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 140px;
}

.ho-prompt-summary .kv-grid,
.recon-match-modal .kv-grid {
  margin: 0;
}

/* /testdistribution: money states, UTR, hand over */
#testRoot .money-metric-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

#testRoot .money-metric-grid > div.money-attention {
  border-radius: var(--radius);
  background: var(--warning-bg);
}

#testRoot .utr-field-hint,
#testRoot .store-upi-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

#testRoot .handover-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

#testRoot .handover-history-row:first-child {
  border-top: 0;
}

#testRoot .handover-history-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

#testRoot .handover-history-amount {
  text-align: right;
}

#testRoot .ho-status {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 12px;
  font-weight: 700;
}

#testRoot .ho-status.good {
  background: var(--success-bg);
  color: var(--success);
}

#testRoot .ho-status.warn {
  background: var(--warning-bg);
  color: var(--warning);
}

#testRoot .ho-status.bad {
  background: var(--danger-bg);
  color: var(--danger);
}

#testRoot .rejected-upi-card {
  border-color: var(--danger-line);
}

#testRoot .handover-form-card .payment-method-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
