/* PAYE-CASH dashboard design system -- shared by the merchant dashboard
   (/dashboard) and the Owner console (/owner-console). Visual language
   adapted from the supplied merchant prototype screenshots: vivid green
   primary, white cards on a light-gray page background, rounded corners,
   a colored left-accent bar on page headers, pill-shaped status badges. */

:root {
  --color-primary: #22c55e;
  --color-primary-dark: #16a34a;
  --color-primary-darker: #15803d;
  --color-primary-light: #dcfce7;
  --color-primary-lighter: #f0fdf4;
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-text-faint: #9ca3af;
  --color-danger: #dc2626;
  --color-danger-dark: #b91c1c;
  --color-danger-light: #fee2e2;
  --color-warning: #d97706;
  --color-warning-dark: #92400e;
  --color-warning-light: #fef3c7;
  --color-info: #1d4ed8;
  --color-info-light: #dbeafe;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.08);
  --font-sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --header-height: 60px;
  --sidebar-width: 240px;
  --tabbar-height: 64px;
  --content-max-width: 640px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Links use the darkest brand green: the mid green fails AA contrast on
   white for body-size text, and links are body-size text. */
a {
  color: var(--color-primary-darker);
}

h1,
h2,
h3 {
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Visually hidden but screen-reader accessible. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Persistent, unmissable indicator of which real-money network this
   deployment is wired to. Shown on every page (both dashboards' shells and
   both login pages). Text/variant is chosen server-side from the explicit,
   validated BITCOIN_NETWORK setting (see src/net/environmentBanner.ts) --
   never inferred from hostname or NODE_ENV. Default (no modifier class) is
   the local/regtest amber warning; --mainnet below is the louder, red
   production warning. */
.env-banner {
  background: #78350f;
  color: #fef3c7;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 6px 12px;
}

.env-banner--mainnet {
  background: #7f1d1d;
  color: #fee2e2;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 8px;
  box-shadow: var(--shadow-md);
}

:focus-visible {
  outline: 3px solid var(--color-primary-dark);
  outline-offset: 2px;
}

/* ---------- Top header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

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

.app-header__brand {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--color-bg);
}

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

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.notification-badge-wrap {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 400px;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  z-index: 21;
}

.notification-panel__header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

.notification-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: none;
  cursor: pointer;
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item:hover {
  background: var(--color-primary-lighter);
}

.notification-item--unread {
  background: var(--color-primary-lighter);
}

.notification-item__title {
  font-weight: 700;
  font-size: 13px;
}

.notification-item__amount {
  font-weight: 700;
  color: var(--color-primary-darker);
}

.notification-item__time {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- Layout shells ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar-height) + 24px);
}

/* ---------- Page header (green left-accent bar) ---------- */

.page-header {
  border-left: 4px solid var(--color-primary);
  padding-left: 16px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

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

.page-header--with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header__text {
  min-width: 0;
  flex: 1 1 260px;
}

.page-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-header__actions .btn {
  width: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 12px;
}

.back-link:hover {
  text-decoration: underline;
}

/* ---------- Cards ---------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.card--outline {
  box-shadow: none;
  border: 1px solid var(--color-border);
}

.card--tinted {
  background: linear-gradient(135deg, var(--color-primary-lighter), var(--color-surface));
  border: 1px solid var(--color-primary-light);
}

.card > h2:first-child {
  margin: 0 0 4px;
  font-size: 17px;
}

.card > h2 + p {
  margin: 0 0 14px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.card--collapsed {
  display: none;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

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

.balance-card {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-darker));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-md);
}

.balance-card__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
  margin: 0 0 8px;
}

.balance-card__value {
  font-size: 30px;
  font-weight: 700;
  margin: 0;
}

/* Buttons placed on the green balance card need light-on-dark variants. */
.balance-card .btn--outline {
  background: #fff;
  color: var(--color-primary-darker);
  border-color: #fff;
}

.balance-card .btn--outline:hover {
  background: var(--color-primary-lighter);
}

.balance-card .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.65);
}

.balance-card .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 6px;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.stat-card__hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 6px 0 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

.section-heading a,
.link-button {
  color: var(--color-primary-darker);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.section-heading a:hover,
.link-button:hover {
  text-decoration: underline;
}

/* ---------- Badges & pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.badge--positive {
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
  border-color: transparent;
}

.badge--neutral {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-color: transparent;
}

.badge--warning {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
  border-color: transparent;
}

.badge--danger {
  background: var(--color-danger-light);
  color: var(--color-danger-dark);
  border-color: transparent;
}

.badge--info {
  background: var(--color-info-light);
  color: var(--color-info);
  border-color: transparent;
}

.badge--outline-primary {
  background: #fff;
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}

.btn--auto {
  width: auto;
}

.btn--primary {
  background: var(--color-primary);
  color: #0b3b1e;
}

.btn--primary:hover {
  background: var(--color-primary-dark);
}

.btn:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--primary:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  opacity: 1;
}

.btn--busy {
  position: relative;
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}

.btn--danger:hover {
  background: var(--color-danger-dark);
}

.btn--outline {
  background: #fff;
  color: var(--color-primary-dark);
  border: 1.5px solid var(--color-primary);
}

.btn--outline:hover {
  background: var(--color-primary-lighter);
}

.btn--danger-outline {
  background: #fff;
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger);
}

.btn--danger-outline:hover {
  background: var(--color-danger-light);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 13px;
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
}

.field--active label {
  color: var(--color-primary-dark);
}

.field--active select,
.field--active input {
  border-color: var(--color-primary);
}

.field-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-danger-dark);
  margin: 6px 0 0;
}

/* Drawn with CSS only: the page CSP is img-src 'self', so no data: URIs. */
.field-error::before {
  content: '!';
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--color-danger-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--color-danger);
}

.field--invalid label {
  color: var(--color-danger-dark);
}

.field input:disabled,
.field input[readonly] {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

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

.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-text-faint);
}

.field-optional {
  font-weight: 400;
  color: var(--color-text-faint);
}

[data-form-error]:empty {
  display: none;
}

/* Password field: show/hide toggle inside the control, live requirement
   line beneath it. */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary-darker);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--color-primary-lighter);
}

.field-req {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.field-req__icon {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--color-text-faint);
  flex-shrink: 0;
}

.field-req--met {
  color: var(--color-primary-darker);
}

.field-req--met .field-req__icon {
  border-color: var(--color-primary-darker);
  background: var(--color-primary-darker);
}

/* CSS-drawn check mark (no data: URI -- see .field-error). */
.field-req--met .field-req__icon::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---------- Transaction / list rows ---------- */

.row-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.row-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.row-card__amount {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.row-card__amount--positive {
  color: var(--color-primary-darker);
}

.row-card__amount--negative {
  color: var(--color-text);
}

.row-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}

.row-card__grid dt {
  color: var(--color-text-muted);
  margin: 0 0 2px;
}

.row-card__grid dd {
  margin: 0;
  font-weight: 600;
}

.timeline-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item__title {
  font-weight: 700;
  margin: 0 0 2px;
}

.timeline-item__sub {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 6px;
}

.timeline-item__amount {
  font-weight: 700;
  margin: 0 0 4px;
}

.timeline-item__date {
  color: var(--color-text-muted);
  font-size: 12px;
  margin: 0;
}

/* ---------- Empty / loading / error states ---------- */

.state-block {
  text-align: center;
  padding: 40px 16px;
  color: var(--color-text-muted);
}

.state-block--card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.state-block__icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.state-block p {
  margin: 0;
  font-size: 14px;
}

.state-block__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 4px !important;
}

.state-block .btn {
  width: auto;
  margin-top: 14px;
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.banner {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.banner--error {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.banner--success {
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
}

.banner--warning {
  background: var(--color-warning-light);
  color: var(--color-warning-dark);
}

.banner--info {
  background: var(--color-info-light);
  color: var(--color-info);
}

.banner p {
  margin: 0 0 6px;
}

.banner p:last-child {
  margin-bottom: 0;
}

/* Toast, announced to assistive tech via aria-live on the container. */
.toast-region {
  position: fixed;
  bottom: calc(var(--tabbar-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  color: #fff;
  background: var(--color-text);
}

.toast--success {
  background: var(--color-primary-darker);
}

.toast--error {
  background: var(--color-danger);
}

/* ---------- Nav drawer (mobile) ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  z-index: 30;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 84vw);
  background: var(--color-surface);
  z-index: 31;
  box-shadow: var(--shadow-md);
  overflow-y: auto;
}

.drawer__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--color-border);
}

.drawer__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.drawer__title {
  font-weight: 700;
  margin: 0;
}

.drawer__subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-muted);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 10px;
}

.nav-list__item {
  margin-bottom: 4px;
}

.nav-list__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-pill);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
}

.nav-list__link:hover {
  background: var(--color-bg);
}

.nav-list__link[aria-current='page'] {
  background: var(--color-primary-light);
  color: var(--color-primary-darker);
}

.nav-list__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ---------- Bottom tab bar (mobile) ---------- */

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 15;
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 11px;
  cursor: pointer;
}

.tab-bar__item[aria-current='page'] {
  color: var(--color-primary-darker);
  font-weight: 600;
}

.tab-bar__item svg {
  width: 22px;
  height: 22px;
}

/* ---------- Utility ---------- */
/* Small, generic spacing/typography utilities -- kept in an external
   stylesheet rather than inline `style=""` attributes on JS-generated
   markup, which a strict `style-src 'self'` CSP (no 'unsafe-inline')
   rejects outright. */

.u-m0 {
  margin: 0;
}

.u-mt-0 {
  margin-top: 0;
}

.u-mt-8 {
  margin-top: 8px;
}

.u-mt-10 {
  margin-top: 10px;
}

.u-mt-12 {
  margin-top: 12px;
}

.u-mt-14 {
  margin-top: 14px;
}

.u-mt-16 {
  margin-top: 16px;
}

.u-mb-8 {
  margin-bottom: 8px;
}

.u-mb-4 {
  margin-bottom: 4px;
}

.u-mb-6 {
  margin-bottom: 6px;
}

.u-mb-12 {
  margin-bottom: 12px;
}

.u-mb-14 {
  margin-bottom: 14px;
}

.u-mb-16 {
  margin-bottom: 16px;
}

.u-w-full {
  width: 100%;
}

.u-flex-1 {
  flex: 1;
}

.u-min-0 {
  min-width: 0;
}

.u-items-center {
  align-items: center;
}

.u-items-end {
  align-items: flex-end;
}

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

.u-text-sm {
  font-size: 13px;
}

.u-fs-20 {
  font-size: 20px;
}

.u-label-sm {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.u-amount-lg {
  font-size: 20px;
  font-weight: 700;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-danger {
  color: var(--color-danger);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

table.data-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data-table tbody tr:hover {
  background: var(--color-bg);
}

/* ---------- Auth (login) pages ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  box-shadow: var(--shadow-md);
}

.auth-card__logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 16px;
}

.auth-card h1 {
  text-align: center;
  font-size: 20px;
  margin: 0 0 4px;
}

.auth-card__subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}

.auth-card__footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 20px 0 0;
}

/* ---------- Modal (confirm dialog) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 39, 0.5);
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}

.modal__title {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal__body {
  margin: 0 0 18px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Desktop layout ---------- */

@media (min-width: 860px) {
  :root {
    --content-max-width: 1040px;
  }

  .app-shell--with-sidebar {
    flex-direction: row;
  }

  .sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    min-height: 100vh;
    position: sticky;
    top: 0;
  }

  .sidebar .drawer__header {
    border-bottom: 1px solid var(--color-border);
  }

  .app-shell--with-sidebar .app-main {
    padding-bottom: 32px;
    max-width: 900px;
  }

  .tab-bar,
  .drawer-overlay,
  .drawer {
    display: none;
  }

  .app-shell--with-sidebar .tab-bar,
  .app-shell--with-sidebar .drawer-overlay,
  .app-shell--with-sidebar .drawer {
    display: none !important;
  }

  .hamburger-button {
    display: none;
  }

  .card-grid--two {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .app-main {
    padding-top: 28px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .balance-card__value {
    font-size: 34px;
  }

  .toast-region {
    bottom: 24px;
  }
}

@media (max-width: 859px) {
  .sidebar {
    display: none;
  }

  /* "PAYE-CASH Owner Console" doesn't fit beside the header controls on a
     phone; the console name is still announced via the page title. */
  .app-header__brand-suffix {
    display: none;
  }
}

/* ---------- Liquidity usage bar (Owner Console > Lightning Liquidity) ---------- */

/*
 * Shows how much of a channel's USABLE limit is currently on our side.
 * Colour tracks remaining inbound, not the used share, because remaining
 * inbound is what runs out. The element carries role="progressbar" and
 * aria-valuenow in the markup, so the reading is available without colour.
 */
.usage-block {
  margin: 12px 0 4px;
}

.usage-block__line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

.usage-bar {
  height: 10px;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}

.usage-bar__fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  transition: width 240ms ease;
}

.usage-bar--low .usage-bar__fill,
.usage-bar--very-low .usage-bar__fill {
  background: var(--color-warning);
}

.usage-bar--critical .usage-bar__fill {
  background: var(--color-danger);
}

.usage-bar--none {
  background: repeating-linear-gradient(
    90deg,
    var(--color-border) 0 6px,
    var(--color-bg) 6px 12px
  );
}

.stat-card .usage-bar {
  margin: 10px 0 2px;
}

@media (prefers-reduced-motion: reduce) {
  .usage-bar__fill {
    transition: none;
  }
}
