/* 01. Design tokens */
:root {
  --canvas: #f3f6fa;
  --surface: #ffffff;
  --ink: #14253c;
  --muted: #728097;
  --line: #e5ebf3;
  --primary: #1f63ef;
  --primary-soft: #edf3ff;
  --success: #087a5c;
  --danger: #c83d4a;
  --radius: 22px;
  --shadow: 0 6px 30px rgb(31 49 83 / 5%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #e9eef5;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
/* 02. Base and accessibility */
* {
  box-sizing: border-box;
}
body {
  margin: 0 auto;
  max-width: 520px;
  min-height: 100dvh;
  background: var(--canvas);
}
html,
body {
  touch-action: pan-x pan-y;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
a {
  color: var(--primary);
  text-decoration: none;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #91b8ff;
  outline-offset: 3px;
}
.hide {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 16px;
}
h3 {
  font-size: 15px;
  margin: 22px 0 12px;
}
p {
  line-height: 1.75;
}
.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.success {
  color: var(--success);
}
/* 03. Application shell */
header {
  padding: 24px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--ink);
  color: white;
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
}
.brand-copy {
  flex: 1;
  min-width: 0;
}
header h1 {
  font-size: 17px;
  letter-spacing: -0.3px;
}
header h1 small {
  display: inline-block;
  font-size: 10px;
  background: #e8eef9;
  color: #526b8c;
  border-radius: 5px;
  padding: 2px 5px;
}
#who {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.network-pill {
  font-size: 9px;
  font-weight: 700;
  color: var(--success);
  background: #e4f5ee;
  border-radius: 20px;
  padding: 6px 8px;
  white-space: nowrap;
}
.network-pill::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0e9974;
  margin-right: 4px;
}
main {
  padding: 0 18px 110px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 22px;
}
.page-heading h2 {
  font-size: 27px;
  margin: 0;
  letter-spacing: -1px;
}
.page-heading p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.icon-button {
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
}
svg {
  display: block;
  flex-shrink: 0;
}
.mobile-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 20;
  padding: 9px 9px calc(9px + env(safe-area-inset-bottom));
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.mobile-nav button {
  border: none;
  background: transparent;
  border-radius: 14px;
  color: #8995a8;
  padding: 9px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  min-height: 57px;
}
.mobile-nav button.active {
  color: var(--primary);
  background: var(--primary-soft);
}
/* 04. Cards, balances and activity */
.box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.grid {
  display: grid;
  gap: 12px;
}
.grid > .box {
  margin-bottom: 0;
}
#wallet > .grid {
  margin-bottom: 16px;
}
#balances {
  grid-template-columns: 1fr 1fr;
}
#balances .box {
  padding: 20px 16px;
}
#balances h2 {
  margin-bottom: 13px;
  font-size: 13px;
  color: var(--muted);
}
.metric {
  font-size: 27px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.8px;
  overflow-wrap: anywhere;
}
#balances .muted {
  margin-top: 14px;
  font-size: 10px;
}
.hero {
  background: linear-gradient(125deg, #142a4d, #214f8b);
  color: white;
  border: none;
  padding: 26px;
}
.hero .eyebrow {
  color: #9ec0ed;
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.hero h2 {
  font-size: 24px;
  line-height: 1.5;
  letter-spacing: -0.6px;
  margin-bottom: 10px;
}
.hero p {
  font-size: 12px;
  color: #bfceed;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.hero-actions button {
  padding: 11px 16px;
  font-size: 12px;
  min-height: 40px;
}
.hero-actions button.secondary {
  background: rgb(255 255 255 / 12%);
  color: white;
  border-color: rgb(255 255 255 / 20%);
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 2px 14px;
}
.section-label h2 {
  margin: 0;
  font-size: 16px;
}
.section-label span {
  color: var(--muted);
  font-size: 11px;
}
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #eef3f9;
  color: #70829b;
  padding: 13px 15px;
  border: 1px solid #e1e9f2;
  border-radius: 13px;
  font-size: 11px;
  line-height: 1.8;
  margin: 0 0 20px;
}
.invite-card {
  background: linear-gradient(145deg, #eff5ff, #fafcff);
  border-color: #dce7fc;
}
#inviteCode {
  display: block;
  font-size: 32px;
  letter-spacing: 5px;
  color: var(--primary);
  margin: 7px 0;
  font-variant-numeric: tabular-nums;
}
#inviteLink {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  padding: 12px 0 15px;
}
.profile-card {
  display: flex;
  gap: 14px;
  align-items: center;
}
.avatar {
  width: 50px;
  height: 50px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 16px;
  display: grid;
  place-items: center;
}
#accountName {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
#logoutButton {
  width: 100%;
  margin-top: 18px;
  color: var(--danger);
  background: #fff4f4;
  border-color: #ffe0e3;
}
/* 05. Inputs and buttons */
button {
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  font-size: 13px;
  border-radius: 12px;
  padding: 13px 17px;
  min-height: 46px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:active {
  transform: translateY(1px);
}
button.secondary {
  color: #536786;
  background: #f2f5fa;
  border-color: var(--line);
}
label {
  display: block;
  color: #5d6b80;
  font-size: 12px;
  font-weight: 550;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
  color: var(--ink);
  padding: 14px;
  margin: 9px 0 18px;
  min-height: 48px;
  font-size: 16px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input::placeholder,
textarea::placeholder {
  color: #a0aab9;
  font-size: 13px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8eb4ff;
  background: white;
  box-shadow: 0 0 0 3px #edf3ff;
}
form button[type="submit"],
#submitButton,
#withdrawForm button {
  width: 100%;
}
#depositAddress {
  padding: 15px;
  background: #f4f7fc;
  border: 1px dashed #d4dfef;
  border-radius: 12px;
  margin: 14px 0;
  word-break: break-all;
  font:
    12px/1.8 ui-monospace,
    monospace;
}
.box > .muted {
  margin-bottom: 17px;
}
.box > .muted:last-child {
  margin: 14px 0 0;
}
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 65px;
}
.password-toggle {
  position: absolute;
  top: 9px;
  right: 5px;
  min-height: 48px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 11px;
  padding: 10px;
}
/* 06. Mobile records, status and empty states */
.wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
th {
  padding: 12px 8px;
  color: var(--muted);
  background: #f8fafd;
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}
td {
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
  color: #42546e;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 12px;
  text-align: center;
  color: var(--muted);
}
.empty-state svg {
  color: #b4c5dc;
}
.empty-state strong {
  color: #71829a;
  font-size: 13px;
}
.empty-state p {
  font-size: 11px;
}
.status-pill {
  display: inline-block;
  padding: 5px 8px;
  font-size: 10px;
  border-radius: 7px;
  white-space: nowrap;
  background: #eef3fb;
  color: #546e96;
}
.status-paid {
  background: #e6f7ef;
  color: #087a5c;
}
.status-rejected {
  background: #fff0f1;
  color: #ba4651;
}
.status-pending {
  background: #fff5e4;
  color: #ab7625;
}
.status-approved {
  background: #eaf1ff;
  color: #386ccd;
}
.record-list {
  display: block;
}
.record-list thead {
  display: none;
}
.record-list tbody {
  display: flex;
  flex-direction: column;
}
.record-list tr:not(:has(.empty-state)) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.record-list td {
  display: block;
  border: none;
  padding: 3px 0;
  font-size: 12px;
  min-width: 0;
}
.record-list td::before {
  content: attr(data-label);
  display: block;
  font-size: 10px;
  color: #929db0;
  margin-bottom: 4px;
}
.record-list tr:last-child {
  border-bottom: none;
}
.record-list td:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
/* 07. Authentication */
.auth-page {
  background: var(--surface);
}
.auth-page main {
  padding-top: 5px;
  padding-bottom: 40px;
}
.auth-page header {
  padding-top: 28px;
}
.auth-page .notice {
  margin-top: 20px;
}
.auth-page .login-panel {
  margin: 16px 0 0;
  padding: 12px 4px;
  border: none;
  box-shadow: none;
  border-radius: 0;
}
.auth-page .login-panel h2 {
  font-size: 29px;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.auth-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 30px;
}
.auth-page .login-panel > p:last-child {
  text-align: center;
  font-size: 12px;
  margin-top: 25px;
}
.auth-page #authForm {
  margin-top: 25px;
}
.auth-page #submitButton {
  margin-top: 7px;
}
/* 08. Feedback and loading */
#message {
  position: fixed;
  z-index: 60;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(90vw, 470px);
  border-radius: 13px;
  padding: 14px 18px;
  background: #193253;
  color: white;
  font-size: 12px;
  box-shadow: 0 12px 35px #15294430;
  line-height: 1.7;
}
#message[data-type="error"] {
  background: #a63748;
}
#message[data-type="success"] {
  background: #12765d;
}
.auth-page #message {
  bottom: 24px;
}
.load-bar {
  position: fixed;
  left: 0;
  top: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    #1f63ef,
    #65c9ff,
    transparent
  );
  z-index: 80;
  animation: load-slide 1.2s infinite linear;
}
@keyframes load-slide {
  from {
    background-position: -100vw 0;
  }
  to {
    background-position: 100vw 0;
  }
}
.loading-card {
  border-radius: 22px;
  background: white;
  padding: 24px;
  border: 1px solid var(--line);
}
.skeleton {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf1f6 25%, #f8fafc 50%, #edf1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  margin: 14px 0;
}
.skeleton:first-child {
  width: 40%;
}
.skeleton:last-child {
  width: 70%;
  height: 35px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.page-error {
  padding: 30px 20px;
  border-radius: 18px;
  background: #fff1f2;
  color: #a34452;
  font-size: 13px;
  line-height: 1.8;
}
.page-error button {
  margin-top: 15px;
}
.field-error {
  font-size: 12px;
  color: var(--danger);
  margin: 14px 0;
  background: #fff2f3;
  padding: 12px;
  border-radius: 10px;
}
/* 09. Screen sizes and reduced motion */
@media (max-width: 360px) {
  main {
    padding-left: 12px;
    padding-right: 12px;
  }
  header {
    padding-left: 16px;
    padding-right: 16px;
  }
  .box {
    padding: 18px;
  }
  .network-pill {
    display: none;
  }
  .metric {
    font-size: 22px;
  }
}
@media (min-width: 600px) {
  body {
    box-shadow: 0 0 70px #18325115;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#balances {
  margin-bottom: 18px;
}
#balances > .empty-state {
  grid-column: 1 / -1;
}
#teamMembers td {
  word-break: break-all;
}
