/* Ensure footer uses JetBrains Mono and matches index.html */
.site-footer, .site-footer * {
  font-family: "JetBrains Mono", monospace !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em !important;
}
/* Custom Dialog Styles */
.custom-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.custom-dialog-content {
  background: var(--surface, #1A1A1A);
  color: var(--text, #FCFCFC);
  padding: 32px 24px 24px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.25);
  min-width: 260px;
  text-align: center;
}
.custom-dialog-actions {
  margin-top: 18px;
  display: flex;
  gap: 16px;
  justify-content: center;
}
:root {
  --bg: #0A0A0C;
  --surface: #131316;
  --text: #FCFCFC;
  --muted: #8E9CAE;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(210, 248, 152, 0.4);

  --lime: #D2F898;
  --lime-glow: rgba(210, 248, 152, 0.15);
  --yellow: #F6F930;
  --positive: #7CFFB2;
  --negative: #FF7C7C;

  --radius-card: 20px;
  --radius-btn: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 120px 22px 48px;
}

/* ---------- TOP BAR ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 22px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 16px;
}

.brand-the { color: var(--muted); }
.brand-level { color: var(--lime); }
.brand-dot,
.brand-app { color: var(--yellow); }

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- CARDS ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-top: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

h1, h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

.status {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- PROFILE GRID ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 16px;
  background: rgba(10, 10, 12, 0.4);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.field:hover {
  border-color: rgba(210, 248, 152, 0.2);
}

.label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

/* ---------- CREDITS ---------- */

.credit-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.credit-summary .value {
  font-size: 18px;
  font-weight: 600;
}

/* Use the browser/OS-native page scrollbar on the account screen. */
html {
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  scrollbar-width: auto !important;
  scrollbar-color: auto !important;
}

body {
  min-height: 100%;
  overflow: visible !important;
}
.credit-pools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.credit-pool { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(10, 10, 12, .4); }
.credit-pool .pool-name { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.credit-pool .pool-value { margin-top: 8px; color: var(--lime); font-size: 18px; font-weight: 600; }
.credit-pool .pool-expiry { margin-top: 5px; color: var(--muted); font-size: 10px; }

.positive { color: var(--positive); }
.negative { color: var(--negative); }

.table-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.table-controls select {
  margin: 0 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
}

/* ---------- LEDGER TABLE ---------- */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ledger thead th {
  text-align: left;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.ledger tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.ledger tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- PAGINATION ---------- */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.pagination button {
  appearance: none;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--lime);
  background: rgba(210, 248, 152, 0.05);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#pageInfo {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- ACTIONS ---------- */

.actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.account-webapp-action {
  display: block;
  width: 100%;
  margin: 0 0 22px;
  padding: 16px 24px;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 26px var(--lime-glow);
}

.btn {
  appearance: none;
  font-family: "JetBrains Mono", monospace;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-danger:hover:not(:disabled) {
  border-color: var(--negative);
  background: rgba(255, 124, 124, 0.05);
}

.btn-primary {
  background: var(--lime);
  color: #000000;
  border-color: var(--lime);
  font-weight: 600;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, background-color 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
  background: #e8ff75;
  border-color: #e8ff75;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--lime-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: #5a6d4a;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.6;
}


/* ---------- MESSAGE ---------- */

.message {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 720px) {
  .grid { 
    grid-template-columns: 1fr; 
  }
  
  .credit-summary { 
    grid-template-columns: 1fr; 
  }
  .credit-pools { grid-template-columns: 1fr; }
  
  /* Page spacing */
  .page {
    padding: 90px 16px 40px;
  }
  
  /* Top bar */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 0 18px;
  }
  
  .brand {
    font-size: 22px;
    text-align: center;
  }
  
  .topbar-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* Cards */
  .card {
    padding: 18px;
    margin-top: 16px;
  }
  
  .card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  /* Profile info */
  .info-row {
    flex-direction: column;
    gap: 4px;
  }
  
  .label {
    font-size: 12px;
  }
  
  .value {
    font-size: 14px;
  }
  
  /* Credit balance */
  .balance {
    font-size: 32px;
  }
  
  /* Ledger table */
  .ledger-table {
    font-size: 12px;
  }
  
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }
  
  .ledger-row span {
    text-align: left !important;
  }
  
  .ledger-row .date {
    order: -1;
    font-size: 11px;
  }
  
  /* Pagination */
  .pagination {
    gap: 8px;
  }
  
  .pagination button {
    padding: 8px 12px;
    font-size: 11px;
  }
  
  #pageInfo {
    font-size: 11px;
  }
  
  /* Actions */
  .actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    text-align: center;
    min-height: 44px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 80px 12px 32px;
  }
  
  .brand {
    font-size: 18px;
  }
  
  .card {
    padding: 16px;
  }
  
  h1 {
    font-size: 18px;
  }
  
  .balance {
    font-size: 28px;
  }
}

/* App-aligned account surfaces */
.page { max-width: 1080px; }

.card {
  background: linear-gradient(145deg, rgba(21, 23, 25, 0.98), rgba(15, 17, 19, 0.98));
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.card .card {
  background: rgba(10, 10, 12, 0.32);
  box-shadow: none;
}

.card-head { border-bottom-color: rgba(255, 255, 255, 0.08); }

.card-head h1,
.card h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.field,
.credit-pool {
  background: rgba(10, 10, 12, 0.55);
  border-color: rgba(255, 255, 255, 0.09);
}

.field:hover,
.credit-pool:hover {
  border-color: rgba(210, 248, 152, 0.28);
}

.ledger tbody tr { transition: background-color 0.18s ease; }
.ledger tbody tr:hover { background: rgba(210, 248, 152, 0.035); }

.status {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

@media (max-width: 720px) {
  .card { border-radius: 20px; }
  .ledger { display: block; overflow-x: auto; }
}

/* Mobile account layout */
@media (max-width: 720px) {
  .page {
    width: 100%;
    padding: 82px 12px 32px;
  }

  .page > .card {
    margin-top: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .page > .card > .card {
    margin-top: 16px;
    padding: 18px;
    background: linear-gradient(145deg, rgba(21, 23, 25, 0.98), rgba(15, 17, 19, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
  }

  .card-head {
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .card-head .status {
    align-self: flex-start;
  }

  .account-webapp-action {
    margin-bottom: 16px;
    padding: 15px 18px;
  }

  .grid,
  .credit-summary,
  .credit-pools {
    gap: 10px;
  }

  .field,
  .credit-pool {
    padding: 14px;
  }

  .table-controls {
    justify-content: flex-start;
  }

  .ledger,
  .ledger tbody,
  .ledger tr,
  .ledger td {
    display: block;
    width: 100%;
  }

  .ledger {
    overflow: visible;
  }

  .ledger thead {
    display: none;
  }

  .ledger tbody {
    display: grid;
    gap: 12px;
  }

  .ledger tbody tr {
    padding: 12px 14px;
    background: rgba(10, 10, 12, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
  }

  .ledger tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: right;
    overflow-wrap: anywhere;
  }

  .ledger tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
  }

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

  .pagination {
    justify-content: space-between;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  #deleteStage1Modal,
  #deleteStage2Modal,
  #deleteStage3Modal {
    padding: 16px;
    overflow-y: auto;
  }

  #deleteStage1Modal > div,
  #deleteStage2Modal > div,
  #deleteStage3Modal > div {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 520px !important;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 22px !important;
    overflow-y: auto;
  }

  #logoutDialog {
    padding: 16px;
  }

  .custom-dialog-content {
    width: min(100%, 420px);
    min-width: 0;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
}

@media (max-width: 380px) {
  .page { padding-inline: 10px; }
  .page > .card > .card { padding: 15px; }
  .ledger tbody td { grid-template-columns: 78px minmax(0, 1fr); }
  .custom-dialog-actions { flex-direction: column; }
}
