:root {
  color-scheme: light;

  --bg: #f4f4f2;
  --bg-soft: #ecece8;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-strong: #ffffff;

  --text: #171917;
  --muted: #646964;
  --line: rgba(23, 25, 23, 0.12);

  --accent: #214f78;
  --accent-soft: rgba(33, 79, 120, 0.08);

  --warning: #8a6840;
  --danger: #9a3f3f;

  --radius: 8px;
  --content: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;

  color: var(--text);

  background:
    radial-gradient(
      circle at 75% 8%,
      rgba(49, 95, 140, 0.09),
      transparent 28rem
    ),
    radial-gradient(
      circle at 8% 44%,
      rgba(23, 107, 87, 0.07),
      transparent 30rem
    ),
    var(--bg);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;

  background-image:
    linear-gradient(
      var(--line) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      var(--line) 1px,
      transparent 1px
    );

  background-size: 70px 70px;

  mask-image:
    linear-gradient(
      to bottom,
      black,
      transparent 90%
    );
}

.account-header {
  position: relative;
  z-index: 10;

  width: min(
    calc(100% - 40px),
    var(--content)
  );

  min-height: 88px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-inline-end: auto;
}

.brand-mark {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(33, 79, 120, 0.32);
  border-radius: 12px;

  background: rgba(33, 79, 120, 0.08);
  color: var(--accent);

  font-weight: 800;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.14em;
}

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

.language-button,
.secondary-button {
  min-height: 42px;
  padding: 0 15px;

  border: 1px solid var(--line);
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
}

.language-button {
  min-width: 92px;
  cursor: pointer;
}

.secondary-button {
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  min-height: 50px;
  padding: 0 22px;

  border: 0;
  border-radius: 999px;

  background: var(--accent);
  color: #fff;

  font-weight: 750;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.disabled-button {
  min-height: 46px;
  padding: 0 18px;

  border: 1px solid var(--line);
  border-radius: 999px;

  background: var(--bg-soft);
  color: var(--muted);
}

.account-main {
  position: relative;
  z-index: 1;

  width: min(
    calc(100% - 40px),
    var(--content)
  );

  margin: 0 auto;
  padding: 46px 0 100px;
}

.state-panel {
  min-height: 55vh;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  color: var(--muted);
}

.loading-dot {
  width: 10px;
  height: 10px;

  border-radius: 50%;
  background: var(--accent);

  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.auth-layout {
  min-height: 620px;

  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(340px, 430px);

  gap: 80px;
  align-items: center;
}

.eyebrow {
  color: var(--accent);

  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.auth-copy h1,
.dashboard-section > h1,
.section-title-row h1 {
  margin: 18px 0;

  font-size:
    clamp(
      2.4rem,
      5vw,
      4.9rem
    );

  line-height: 1;
  letter-spacing: -0.05em;
}

.auth-copy > p,
.section-title-row p {
  max-width: 660px;

  color: var(--muted);
  line-height: 1.75;
}

.registration-note {
  max-width: 620px;

  margin-top: 34px;
  padding: 22px;

  border: 1px solid var(--line);
  border-radius: 20px;

  background: rgba(255, 255, 255, 0.55);
}

.registration-note p {
  color: var(--muted);
  line-height: 1.6;
}

.auth-card,
.content-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);

  background: var(--panel);

  backdrop-filter: blur(18px);

  box-shadow:
    0 30px 80px
    rgba(23, 25, 23, 0.06);
}

.auth-card {
  padding: 30px;

  display: grid;
  gap: 20px;
}

.auth-card label {
  display: grid;
  gap: 8px;

  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.auth-card input {
  width: 100%;
  min-height: 50px;

  padding: 0 14px;

  border: 1px solid var(--line);
  border-radius: 13px;

  outline: 0;

  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.auth-card input:focus {
  border-color: rgba(33, 79, 120, 0.55);

  box-shadow:
    0 0 0 3px
    rgba(33, 79, 120, 0.08);
}

.form-message,
.inline-message {
  min-height: 20px;

  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.form-message.error,
.inline-message.error {
  color: var(--danger);
}

.recovery-note {
  margin: 0;

  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.dashboard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.account-sidebar {
  position: sticky;
  top: 28px;

  padding: 18px;

  border: 1px solid var(--line);
  border-radius: var(--radius);

  background: var(--panel);
  backdrop-filter: blur(18px);
}

.sidebar-user {
  padding: 6px;

  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user > div:last-child {
  min-width: 0;
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user span {
  margin-top: 4px;

  overflow: hidden;
  text-overflow: ellipsis;

  color: var(--muted);
  font-size: 0.78rem;
}

.user-avatar {
  flex: 0 0 auto;

  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  background: var(--accent-soft);
  color: var(--accent);

  font-weight: 850;
}

.account-nav {
  margin-top: 24px;

  display: grid;
  gap: 6px;
}

.account-nav-item {
  width: 100%;

  padding: 12px 13px;

  border: 0;
  border-radius: 12px;

  background: transparent;
  color: var(--muted);

  text-align: start;
  cursor: pointer;
}

.account-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}

.sidebar-future {
  margin-top: 28px;
  padding: 14px;

  border-top: 1px solid var(--line);

  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.dashboard-content {
  min-width: 0;
}

.dashboard-section {
  min-height: 640px;
}

.summary-grid {
  margin-top: 42px;

  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 14px;
}

.summary-card {
  min-height: 145px;

  padding: 20px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  border: 1px solid var(--line);
  border-radius: 18px;

  background: var(--panel);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-card strong {
  font-size: 1.1rem;
}

.content-card {
  margin-top: 24px;
  padding: 24px;
}

.content-card-heading h2 {
  margin: 0 0 18px;
}

.organization-row {
  padding: 14px 0;

  display: flex;
  justify-content: space-between;
  gap: 18px;

  border-top: 1px solid var(--line);
}

.organization-row:first-child {
  border-top: 0;
}

.organization-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.section-title-row h1 {
  margin-bottom: 10px;
}

.devices-grid {
  margin-top: 28px;

  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 16px;
}

.device-card {
  padding: 22px;

  border: 1px solid var(--line);
  border-radius: 20px;

  background: var(--panel);
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.device-card h3 {
  margin: 0;

  font-size: 1.05rem;
}

.device-status {
  padding: 5px 9px;

  border-radius: 999px;

  background: var(--accent-soft);
  color: var(--accent);

  font-size: 0.72rem;
  font-weight: 750;
}

.device-meta {
  margin-top: 20px;

  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 12px;
}

.device-property {
  min-width: 0;
}

.device-property span,
.device-property strong {
  display: block;
}

.device-property span {
  color: var(--muted);
  font-size: 0.72rem;
}

.device-property strong {
  margin-top: 4px;

  overflow-wrap: anywhere;

  font-size: 0.86rem;
}

.empty-state {
  grid-column: 1 / -1;

  padding: 42px 24px;

  border: 1px dashed var(--line);
  border-radius: 20px;

  color: var(--muted);
  text-align: center;
}

html[dir="rtl"] .account-nav-item {
  text-align: right;
}

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

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

  .account-sidebar {
    position: static;
  }

  .account-nav {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 680px) {
  .account-header {
    width: min(
      calc(100% - 24px),
      var(--content)
    );

    min-height: 76px;
  }

  .brand-name {
    display: none;
  }

  .account-main {
    width: min(
      calc(100% - 24px),
      var(--content)
    );

    padding-top: 30px;
  }

  .header-actions {
    gap: 6px;
  }

  .language-button,
  .secondary-button {
    min-height: 38px;
    padding-inline: 11px;
  }

  .auth-card {
    padding: 22px;
  }

  .summary-grid,
  .devices-grid {
    grid-template-columns: 1fr;
  }

  .section-title-row {
    align-items: start;
    flex-direction: column;
  }
}

/* Account economic/provenance surfaces */
.records-list {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.record-card,
.cash-card {
  padding: 20px;

  border: 1px solid var(--line);
  border-radius: 18px;

  background: var(--panel);
}

.record-card strong,
.cash-card strong {
  display: block;
}

.record-meta {
  margin-top: 8px;

  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.cash-grid {
  margin-top: 28px;

  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 14px;
}

.cash-value {
  margin-top: 22px;

  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

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

/* Withdrawal / settlement UI */
.withdrawal-layout {
  margin-top: 24px;

  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 16px;
}

.withdrawal-layout .content-card {
  margin-top: 0;
}

.withdrawal-status-box {
  margin-top: 8px;

  font-size: 1.35rem;
  font-weight: 800;
}

.compact-records {
  margin-top: 12px;
}

.payout-method-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.compact-button {
  min-height: 36px;
  padding-inline: 12px;
  flex: 0 0 auto;
}

.withdrawal-form {
  margin-top: 20px;

  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(0, 1fr)
    minmax(120px, 0.5fr);

  gap: 14px;
  align-items: end;
}

.withdrawal-form label {
  display: grid;
  gap: 8px;

  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.withdrawal-form input,
.withdrawal-form select {
  width: 100%;
  min-height: 46px;

  padding: 0 13px;

  border: 1px solid var(--line);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.withdrawal-actions {
  grid-column: 1 / -1;

  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.withdrawal-quote {
  margin-top: 18px;

  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 12px;
}

.withdrawal-quote > div {
  padding: 16px;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: var(--bg-soft);
}

.withdrawal-quote span,
.withdrawal-quote strong {
  display: block;
}

.withdrawal-quote span {
  color: var(--muted);
  font-size: 0.76rem;
}

.withdrawal-quote strong {
  margin-top: 7px;
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.history-heading h2 {
  margin-bottom: 0;
}

@media (max-width: 860px) {
  .withdrawal-layout,
  .withdrawal-form,
  .withdrawal-quote {
    grid-template-columns: 1fr;
  }

  .payout-method-card {
    align-items: stretch;
    flex-direction: column;
  }
}

/* BITMATIA_SUPABASE_AUTH_V1 */

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
}

.auth-mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-mode-button.active {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow:
    0 4px 16px rgba(23, 25, 23, 0.06);
}

#mfa-enrollment {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.mfa-qr {
  width: min(260px, 100%);
  aspect-ratio: 1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

#mfa-secret {
  width: 100%;
  padding: 12px;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: var(--bg-soft);
  text-align: center;
  user-select: all;
}

/* BITMATIA_COMPANY_PORTAL_LINK_V1 */
.organization-portal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid #d2d2cc;
  border-radius: 8px;
  background: #f4f4f2;
  color: #191919;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.organization-portal-link:hover {
  background: #eaeae6;
}

/* BITMATIA_ACCOUNT_PROTOCOL_VISUAL_V2 */

body {
  background: var(--bg);
}

.background-grid {
  opacity: 0.65;

  background-image:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 79px,
      rgba(23, 25, 24, 0.035) 80px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 79px,
      rgba(23, 25, 24, 0.035) 80px
    );

  background-size: auto;
  mask-image: none;
}

.account-header {
  min-height: 88px;

  border-bottom:
    1px solid
    var(--line);
}

.brand-mark {
  width: 34px;
  height: 34px;

  border:
    1px solid
    var(--accent);

  border-radius: 4px;

  background: transparent;

  font-size: 0.82rem;
}

.brand-name {
  font-size: 0.92rem;
  letter-spacing: 0.17em;
}

.language-button,
.secondary-button,
.primary-button,
.disabled-button,
.compact-button {
  border-radius: 4px;
  box-shadow: none;
}

.language-button,
.secondary-button {
  background: transparent;
  border-color: #b9bcb7;
}

.primary-button {
  min-height: 46px;

  border:
    1px solid
    var(--accent);

  background: var(--accent);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: transparent;
  color: var(--accent);
}

.account-main {
  padding-top: 56px;
}

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

  font-size: 0.72rem;
  letter-spacing: 0.20em;
}

.eyebrow::before {
  content: "";

  width: 28px;
  height: 1px;

  background: var(--accent);
}

.auth-copy h1,
.dashboard-section > h1,
.section-title-row h1 {
  font-weight: 650;
}

.registration-note,
.auth-card,
.content-card,
.account-sidebar,
.summary-card,
.device-card,
.record-card,
.cash-card,
.empty-state,
.withdrawal-quote > div,
.mfa-qr,
#mfa-secret {
  border-radius: 8px;

  box-shadow: none;
  backdrop-filter: none;
}

.registration-note,
.auth-card,
.content-card,
.account-sidebar,
.summary-card,
.device-card,
.record-card,
.cash-card {
  background: transparent;
}

.auth-card,
.content-card,
.account-sidebar {
  border-color: var(--line);
}

.auth-card {
  padding: 28px;
}

.auth-card input,
.withdrawal-form input,
.withdrawal-form select {
  border-radius: 4px;

  background: #ffffff;

  box-shadow: none;
}

.auth-card input:focus,
.withdrawal-form input:focus,
.withdrawal-form select:focus {
  border-color: var(--accent);

  outline:
    2px solid
    rgba(33, 79, 120, 0.14);

  outline-offset: 1px;

  box-shadow: none;
}

.auth-mode-switch {
  gap: 0;
  padding: 0;

  border-radius: 4px;

  background: transparent;
}

.auth-mode-button {
  border-radius: 0;

  border-right:
    1px solid
    var(--line);

  background: transparent;
}

.auth-mode-button:last-child {
  border-right: 0;
}

.auth-mode-button.active {
  background: var(--accent-soft);
  color: var(--accent);

  box-shadow: none;
}

.dashboard {
  grid-template-columns:
    248px
    minmax(0, 1fr);

  gap: 38px;
}

.account-sidebar {
  padding: 0;

  border-top:
    2px solid
    var(--accent);
}

.sidebar-user {
  padding: 20px;

  border-bottom:
    1px solid
    var(--line);
}

.user-avatar {
  width: 38px;
  height: 38px;

  border:
    1px solid
    var(--accent);

  border-radius: 4px;

  background: transparent;
}

.account-nav {
  margin-top: 0;

  gap: 0;
}

.account-nav-item {
  min-height: 46px;

  padding:
    0 18px;

  border-radius: 0;

  border-bottom:
    1px solid
    var(--line);
}

.account-nav-item.active {
  position: relative;

  background: var(--accent-soft);
  color: var(--accent);
}

.account-nav-item.active::before {
  content: "";

  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;

  width: 3px;

  background: var(--accent);
}

.sidebar-future {
  margin-top: 0;

  padding: 18px;
}

.summary-grid {
  gap: 0;

  border-top:
    1px solid
    var(--line);

  border-left:
    1px solid
    var(--line);
}

.summary-card {
  border: 0;

  border-right:
    1px solid
    var(--line);

  border-bottom:
    1px solid
    var(--line);
}

.summary-card strong {
  color: var(--text);

  font-size: 1.18rem;
}

.content-card {
  border-top:
    2px solid
    var(--line-strong);
}

.devices-grid,
.records-list,
.cash-grid,
.withdrawal-layout,
.withdrawal-quote {
  gap: 0;
}

.device-card,
.record-card,
.cash-card,
.withdrawal-quote > div {
  border-radius: 0;
}

.devices-grid {
  border-top:
    1px solid
    var(--line);

  border-left:
    1px solid
    var(--line);
}

.device-card {
  border-top: 0;
  border-left: 0;
}

.device-status {
  padding:
    4px 7px;

  border:
    1px solid
    var(--accent);

  border-radius: 4px;

  background: transparent;
}

.records-list {
  border-top:
    1px solid
    var(--line);
}

.record-card {
  border-top: 0;
}

.cash-grid {
  border-top:
    1px solid
    var(--line);

  border-left:
    1px solid
    var(--line);
}

.cash-card {
  border-top: 0;
  border-left: 0;
}

.cash-value {
  color: var(--accent);

  font-weight: 700;
}

.withdrawal-layout {
  border-top:
    1px solid
    var(--line);
}

.withdrawal-layout .content-card {
  border-top: 0;
}

.withdrawal-quote {
  border-top:
    1px solid
    var(--line);

  border-left:
    1px solid
    var(--line);
}

.withdrawal-quote > div {
  border-top: 0;
  border-left: 0;

  background: transparent;
}

.organization-portal-link {
  border-radius: 4px;

  background: transparent;

  border-color: var(--line-strong);
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline:
    2px solid
    var(--accent);

  outline-offset: 3px;
}

html[dir="rtl"] .eyebrow::before {
  order: 2;
}

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

  .account-nav {
    grid-template-columns:
      repeat(2, 1fr);
  }

  .account-nav-item {
    border-right:
      1px solid
      var(--line);
  }
}

@media (max-width: 680px) {
  .account-main {
    padding-top: 36px;
  }

  .summary-grid,
  .devices-grid,
  .cash-grid {
    grid-template-columns: 1fr;
  }

  .account-nav {
    grid-template-columns: 1fr;
  }
}
