/* NJAKAM LIMITED — “Ledger & Tide” design system: calm, retail-friendly, distinct from terminal clichés */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --color-page: #e8edf4;
  --color-page-2: #dce4f0;
  --color-surface: #ffffff;
  --color-surface-elevated: #f8fafc;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #cbd5e1;
  --color-border-soft: #e2e8f0;

  --color-primary: #0f766e;
  --color-primary-soft: #ccfbf1;
  --color-primary-hover: #0d9488;

  --color-online: #0369a1;
  --color-online-soft: #e0f2fe;
  --color-offline: #6d28d9;
  --color-offline-soft: #ede9fe;

  --color-accent: #c2410c;
  --color-accent-soft: #ffedd5;

  --color-success: #15803d;
  --color-success-soft: #dcfce7;
  --color-danger: #b91c1c;
  --color-danger-soft: #fee2e2;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);

  --max-form: 520px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Subtle diagonal mesh — unique without hurting readability */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 100% 0%, rgba(15, 118, 110, 0.09), transparent 50%),
    radial-gradient(ellipse 100% 60% at 0% 100%, rgba(109, 40, 217, 0.06), transparent 45%),
    linear-gradient(165deg, var(--color-page) 0%, var(--color-page-2) 100%);
}

.app-header {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  padding: 1rem 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--color-text);
}

.app-brand__mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  box-shadow: var(--shadow-sm);
}

.app-brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.app-brand__name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.text-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.text-link:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

/* Main card shell */
.container {
  position: relative;
  z-index: 1;
  width: 92%;
  max-width: var(--max-form);
  margin: 0.75rem auto 2rem;
  padding: 1.75rem 1.5rem 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: left;
}

.container > h1:first-child,
.container > h2:first-child,
.container > h3:first-child {
  margin-top: 0;
}

.container > h1,
.container > h2,
.container > h3 {
  text-align: center;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

/* Flash */
.flash {
  background: var(--color-danger-soft);
  border: 1px solid #fecaca;
  color: var(--color-danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash p {
  margin: 0.25rem 0;
}

.flash p:first-child {
  margin-top: 0;
}

.flash p:last-child {
  margin-bottom: 0;
}

/* Forms */
.form-wrap {
  text-align: left;
}

.form-wrap label,
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
  margin-top: 0.75rem;
}

.form-wrap label:first-of-type,
.form-wrap > label:first-child {
  margin-top: 0;
}

/* Inline label + input (e.g. receipt email on card form) */
.form-wrap .form-field--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

.form-wrap .form-field--inline label {
  display: inline-block;
  margin: 0;
  flex: 0 0 auto;
}

.form-wrap .form-field--inline input {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  margin: 0 0 0.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-elevated);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover {
  border-color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

small {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.8rem 1.25rem;
  min-height: 48px;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm), 0 2px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  text-decoration: none;
}

button:hover,
.btn:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-md);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button:disabled,
button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.button-group a {
  text-decoration: none;
  width: 100%;
}

.button-group--links .btn {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.button-group button {
  margin-top: 0;
}

/* Secondary / outline */
.btn--secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 2px solid var(--color-primary-soft);
  box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
  background: var(--color-primary-soft);
}

/* Login */
.login-container {
  text-align: center;
  padding-top: 0.5rem;
}

/* Header already shows large logo + title */
body.app-body .login-container .login-logo {
  display: none;
}

body.app-body .login-container {
  padding-top: 0.25rem;
}

.login-logo {
  display: block;
  margin: 0 auto 1.25rem;
  max-width: 112px;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.login-container h2 {
  margin-bottom: 0.25rem;
}

.login-lead {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

/* Protocol selection */
.protocol-page-title {
  text-align: center;
  margin: 0 0 1.25rem;
  font-size: clamp(1.35rem, 4.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--color-text);
  text-transform: uppercase;
}

.protocol-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.protocol-section {
  border-radius: var(--radius-md);
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-elevated);
}

.protocol-section--online {
  border-left: 4px solid var(--color-online);
  background: linear-gradient(90deg, var(--color-online-soft) 0%, var(--color-surface-elevated) 38%);
}

.protocol-section--offline {
  border-left: 4px solid var(--color-offline);
  background: linear-gradient(90deg, var(--color-offline-soft) 0%, var(--color-surface-elevated) 38%);
}

.protocol-section__head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.protocol-section__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.protocol-section--online .protocol-section__icon {
  background: var(--color-online-soft);
}

.protocol-section--offline .protocol-section__icon {
  background: var(--color-offline-soft);
}

.protocol-section__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
}

.protocol-section__desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0.2rem 0 0;
  line-height: 1.4;
}

.protocol-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.protocol-card {
  display: block;
  cursor: pointer;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  padding: 0;
  margin: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.protocol-card:hover {
  border-color: #94a3b8;
}

.protocol-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.protocol-card__body {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

.protocol-card__code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.protocol-section--offline .protocol-card__code {
  color: var(--color-offline);
}

.protocol-card__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
  text-align: right;
  flex-shrink: 1;
  min-width: 0;
}

.protocol-card:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.protocol-card:has(input:checked) {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.protocol-section--offline .protocol-card:has(input:checked) {
  border-color: var(--color-offline);
  box-shadow: 0 0 0 3px var(--color-offline-soft);
}

.protocol-submit-wrap {
  margin-top: 0.25rem;
}

/* Payout page */
.payout-page .row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.payout-page .row label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.payout-page .row label:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.payout-page input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--color-primary);
}

.field-group {
  margin-top: 1rem;
}

.field-group label {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-btn input {
  flex: 1;
}

#qr-reader:not(.hidden) {
  margin-top: 1rem;
  max-width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.scan-btn {
  background: var(--color-surface-elevated) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.5rem 0.75rem !important;
  min-height: auto !important;
  width: auto !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.scan-btn:hover {
  background: var(--color-border-soft) !important;
}

/* Auth code */
.auth-page #authInput {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  letter-spacing: 0.25em;
  text-align: center;
  padding: 0.9rem 1rem !important;
}

.auth-progress {
  display: none;
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--color-online-soft);
  border: 1px solid #bae6fd;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-online);
}

.auth-warning {
  color: var(--color-danger);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.75rem;
}

/* Success */
.success-container {
  text-align: center;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-size: 1.75rem;
  line-height: 1;
}

.success-container h2 {
  color: var(--color-success);
  font-size: 1.25rem;
}

.success-meta {
  text-align: left;
  background: var(--color-surface-elevated);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--color-border-soft);
}

.success-meta p {
  margin: 0.35rem 0;
}

.success-meta strong {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.success-note {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0.5rem 0 0;
}

/* Decrypting / connecting */
.page-connecting {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  font-family: var(--font-ui);
  background: var(--color-page);
  position: relative;
}

.page-connecting::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(15, 118, 110, 0.12), transparent 55%),
    linear-gradient(180deg, var(--color-page) 0%, var(--color-page-2) 100%);
  z-index: 0;
}

.page-connecting__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 360px;
}

.page-connecting h2 {
  font-weight: 700;
  color: var(--color-text);
  margin: 1rem 0 0.5rem;
}

.page-connecting pre {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-muted);
  opacity: 0.45;
  text-align: left;
  max-height: 120px;
  overflow: hidden;
  margin: 1rem 0 0;
  line-height: 1.2;
}

/* Decrypting (inside main card) */
.decrypting-panel {
  text-align: center;
  padding: 1.5rem 0.5rem 1rem;
}

.decrypting-panel h2 {
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.decrypting-panel pre {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  opacity: 0.5;
  text-align: left;
  max-height: 140px;
  overflow: hidden;
  margin: 0.5rem 0 0;
  line-height: 1.25;
  background: var(--color-surface-elevated);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-soft);
}

/* Processing (full viewport) */
.page-processing {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  background: var(--color-page);
  color: var(--color-text);
  position: relative;
}

.page-processing::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 20%, rgba(3, 105, 161, 0.1), transparent 50%),
    linear-gradient(165deg, var(--color-page) 0%, #e2e8f0 100%);
  z-index: 0;
}

.page-processing.offline-mode::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% 20%, rgba(109, 40, 217, 0.12), transparent 50%),
    linear-gradient(165deg, var(--color-page) 0%, #e2e8f0 100%);
}

.page-processing .processing-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.page-processing h2 {
  font-weight: 700;
  font-size: 1.35rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--color-text);
}

.page-processing #status {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 500;
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.45;
}

.page-processing .spinner {
  margin: 0 auto;
  width: 52px;
  height: 52px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.page-processing.offline-mode .spinner {
  border-top-color: var(--color-offline);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Rejected page */
.page-rejected {
  min-height: 100vh;
  font-family: var(--font-ui);
  background: var(--color-page);
  color: var(--color-text);
  margin: 0;
  position: relative;
  overflow: hidden;
}

.page-rejected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(185, 28, 28, 0.08), transparent 55%);
  z-index: 0;
}

.page-rejected #binary-stream {
  opacity: 0.2;
  color: var(--color-text-muted);
}

.page-rejected #final-message {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
}

.page-rejected #final-message h1 {
  color: var(--color-danger);
}

.page-rejected .btn {
  background: var(--color-danger);
  border-radius: var(--radius-md);
}

/* Utility */
.error-code {
  color: var(--color-danger);
  font-weight: 700;
}

.reason,
.note {
  color: var(--color-text-muted);
}

.fixed-bottom-center {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
}

/* Receipt (in-flow, if used) */
.receipt {
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-mono);
  padding: 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  text-align: left;
  font-size: 0.875rem;
}

.receipt h3 {
  color: var(--color-text);
  text-align: center;
}

.signature-line {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--color-border);
  padding-top: 0.5rem;
}

.signature-note {
  font-style: italic;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  font-family: var(--font-ui);
}

/* ——— App shell header (base.html: login and all terminal pages) ——— */
body.app-body .app-header {
  max-width: 100%;
  width: 100%;
  padding: 0.65rem clamp(0.2rem, 0.8vw, 0.3rem) 0.4rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
}

body.app-body .app-brand {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
}

body.app-body .app-brand__mark {
  width: clamp(80px, 22vw, 128px);
  height: clamp(80px, 22vw, 128px);
}

body.app-body .app-brand__text {
  align-items: center;
}

body.app-body .app-brand__name {
  font-size: clamp(1.35rem, 4.8vw, 2rem);
  letter-spacing: -0.03em;
}

/* ——— Dashboard (full-bleed) ——— */
body.app-body--dashboard {
  align-items: stretch;
}

.container.container--dashboard {
  max-width: 100%;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  margin-top: 0.05rem;
  margin-bottom: 0;
  padding: 0.1rem clamp(0.15rem, 0.6vw, 0.25rem) 0.2rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.dashboard-grid {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0;
  width: min(100%, 24rem);
  max-width: 384px;
  aspect-ratio: 1;
  margin: 0 auto;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.dashboard-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  padding: 0.5rem 0.45rem;
  border-radius: 0;
  border: none;
  box-shadow: none;
  transition: filter 0.15s ease, background-color 0.15s ease;
  text-align: center;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* Single faint wash over whole tile (no seam between icon and title) */
.dashboard-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.38);
  pointer-events: none;
  z-index: 0;
}

/* Flush grid: shared hairline dividers only */
.dashboard-tile:nth-child(odd) {
  border-right: 1px solid rgba(148, 163, 184, 0.5);
}

.dashboard-tile:nth-child(-n + 2) {
  border-bottom: 1px solid rgba(148, 163, 184, 0.5);
}

.dashboard-tile__media {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  padding: 0;
  box-sizing: border-box;
}

.dashboard-tile__icon {
  width: clamp(72px, 58%, 120px);
  height: auto;
  max-height: 58%;
  color: #0f172a;
  flex-shrink: 0;
  display: block;
}

.dashboard-tile__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 1;
  padding: 0;
  box-sizing: border-box;
}

/* Tile fill = same hue as the icon strip (single field of color) */
.dashboard-tile--sale {
  background: #a7f3d0;
}

.dashboard-tile--history {
  background: #7dd3fc;
}

.dashboard-tile--settings {
  background: #cbd5e1;
}

.dashboard-tile--reports {
  background: #fdba74;
}

.dashboard-tile:hover {
  filter: brightness(0.97);
}

.dashboard-tile:active {
  filter: brightness(0.94);
}

.dashboard-tile__title {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0;
  line-height: 1.15;
}

/* ——— Protocol: online / offline split ——— */
body.app-body--protocol-mode {
  align-items: stretch;
}

.container.container--protocol-mode {
  max-width: 560px;
}

.protocol-mode-back {
  margin: 0 0 0.5rem;
}

.protocol-mode-form {
  margin-top: 0.5rem;
}

.protocol-mode-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: min(52vh, 420px);
  margin-top: 0.5rem;
}

.mode-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.5rem 1rem;
  min-height: 200px;
  width: 100%;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: var(--font-ui);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin: 0;
}

.mode-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.mode-tile:active {
  transform: translateY(0);
}

.mode-tile--online {
  background: linear-gradient(160deg, #e0f2fe 0%, #fff 45%, #f8fafc 100%);
  color: var(--color-text);
  border: 2px solid #7dd3fc;
}

.mode-tile--offline {
  background: linear-gradient(160deg, #ede9fe 0%, #fff 45%, #f8fafc 100%);
  color: var(--color-text);
  border: 2px solid #c4b5fd;
}

.mode-tile__label {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mode-tile__hint {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  max-width: 11rem;
}

.mode-tile--online .mode-tile__label {
  color: var(--color-online);
}

.mode-tile--offline .mode-tile__label {
  color: var(--color-offline);
}

/* Print */
@media print {
  body::before {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .app-header,
  .flash,
  .btn,
  .button-group,
  .fixed-bottom-center {
    display: none !important;
  }

  .container {
    box-shadow: none;
    border: none;
    max-width: 100%;
  }
}

/* Transaction history (dashboard → History) */
.history-empty {
  margin-top: 0.75rem;
  text-align: left;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.terminal-gate-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.history-table-wrap {
  margin-top: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.history-grid {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.history-grid th,
.history-grid td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.history-grid thead th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: var(--color-surface-elevated);
  white-space: nowrap;
}

.history-grid tbody tr:last-child td {
  border-bottom: none;
}

.history-grid tbody tr:hover td {
  background: var(--color-primary-soft);
}

.history-amt {
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history-grid .mono {
  font-family: ui-monospace, "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .container {
    width: 94%;
    padding: 1.35rem 1.1rem 1.65rem;
    margin-top: 0.5rem;
  }

  /* Dashboard: keep 2×2 quarters on mobile (not a vertical stack) */
  body.app-body--dashboard {
    min-height: 100dvh;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body.app-body--dashboard > main.container--dashboard {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
  }

  body.app-body .app-header {
    padding: 0.5rem clamp(0.15rem, 0.6vw, 0.25rem) 0.35rem;
  }

  .container.container--dashboard {
    width: 100%;
    max-width: 100%;
    padding: 0;
    min-height: 0;
    flex: 1 1 auto;
    justify-content: center;
    align-items: stretch;
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Full viewport width, fixed vertical footprint */
  .dashboard-grid {
    flex: 0 0 auto;
    width: 100vw;
    max-width: 100vw;
    height: 80vh;
    max-height: 80vh;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0;
    aspect-ratio: unset;
    box-sizing: border-box;
  }

  .dashboard-tile {
    min-height: 0;
    height: 100%;
    padding: 0.4rem 0.35rem;
    border-radius: 0;
    gap: 0.4rem;
  }

  .dashboard-tile__icon {
    width: clamp(76px, 30vw, 128px);
    max-height: 52%;
  }

  .dashboard-tile__title {
    font-size: clamp(1.05rem, 3.8vw, 1.35rem);
    margin-top: 0;
    line-height: 1.12;
  }

  .protocol-mode-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mode-tile {
    min-height: 160px;
  }

  h1 {
    font-size: 1.2rem;
  }

}
