:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #173b3e;
  background: #f3f6f7;
  font-size: 16px;
  line-height: 1.6;
  --teal: #164e50;
  --accent: #e87b47;
  --muted: #63777a;
  --line: #dde6e6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #e87b47;
  outline-offset: 3px;
}
button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  min-height: 46px;
  background: var(--teal);
  color: white;
  font-weight: 650;
}
button.secondary {
  background: #e8efef;
  color: var(--teal);
}
button.ghost {
  background: transparent;
  color: var(--teal);
  padding: 10px 12px;
}
button.danger {
  background: #fff0ef;
  color: #b23932;
}
.small {
  font-size: 0.875rem;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 2rem;
  letter-spacing: -0.045em;
  line-height: 1.25;
}
h2 {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 1rem;
}
a {
  color: var(--teal);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: auto;
  padding: 22px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand-icon {
  height: 34px;
  width: 30px;
  border: 2px solid var(--teal);
  border-radius: 8px 8px 13px 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.account {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #dcebea;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 750;
}
.shell {
  max-width: 850px;
  margin: auto;
  padding: 12px 24px 130px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stack {
  display: grid;
  gap: 18px;
}
.page-head {
  margin: 12px 0 24px;
}
.page-head p {
  margin-top: 8px;
}
.hero {
  position: relative;
  overflow: hidden;
  background: var(--teal);
  color: #fff;
  border-radius: 24px;
  padding: 26px;
  margin-bottom: 24px;
}
.hero:after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border: 1px solid #ffffff20;
  border-radius: 50%;
  right: -40px;
  top: -35px;
  pointer-events: none;
}
.hero .muted {
  color: #bcdddd;
}
.hero h1 {
  font-size: 2.7rem;
  margin: 5px 0 20px;
  font-variant-numeric: tabular-nums;
}
.hero .eyebrow {
  color: #b8dad8;
}
.hero-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid #ffffff25;
  padding-top: 16px;
  gap: 16px;
}
.hero-summary strong {
  display: block;
  font-size: 1.1rem;
}
.tabs {
  display: flex;
  background: #e7eeee;
  padding: 5px;
  border-radius: 15px;
  gap: 4px;
  margin-bottom: 25px;
}
.tabs button {
  flex: 1;
  background: none;
  color: var(--muted);
  min-height: 42px;
  padding: 8px;
}
.tabs button.active {
  background: white;
  color: var(--teal);
  box-shadow: 0 2px 5px #173b3e0c;
}
.section-label {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 22px 0 10px;
  display: flex;
  justify-content: space-between;
}
.expense {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: white;
  color: inherit;
  border: 1px solid var(--line);
  padding: 17px;
  margin-bottom: 10px;
  border-radius: 17px;
  font-weight: 400;
}
.expense:hover {
  border-color: #7aa6a5;
}
.category-icon {
  flex-shrink: 0;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: #edf3f2;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.expense-main {
  flex: 1;
  min-width: 0;
}
.expense-name {
  display: block;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.expense-money {
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.expense-money strong {
  display: block;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
}
.trip-card {
  width: 100%;
  color: inherit;
  text-align: left;
  display: block;
  margin-bottom: 14px;
  background: #fff;
}
.trip-card .tag {
  display: inline-block;
  margin-bottom: 15px;
}
.trip-card h2 {
  margin-bottom: 8px;
}
.tag {
  font-size: 0.75rem;
  background: #e2efed;
  border-radius: 6px;
  padding: 3px 8px;
  color: var(--teal);
  font-weight: 600;
}
.empty {
  text-align: center;
  padding: 42px 20px;
  border: 1px dashed #c8d9d8;
  border-radius: 20px;
}
.empty .empty-symbol {
  font-size: 2rem;
  margin-bottom: 8px;
}
.empty p {
  color: var(--muted);
  margin: 8px 0 22px;
}
.fab-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, #f3f6f7 25%);
  padding: 22px 24px max(22px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  z-index: 2;
}
.fab {
  width: min(100%, 802px);
  background: var(--accent);
  color: #221d16;
  box-shadow: 0 6px 24px #e87b4730;
  border-radius: 16px;
}
.balance {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.balance:last-child {
  border-bottom: 0;
}
.positive {
  color: #167865;
}
.negative {
  color: #b25630;
}
.transfer {
  margin-top: 12px;
  background: #eef5f3;
  border-radius: 14px;
  padding: 15px;
}
.transfer .row {
  flex-wrap: wrap;
}
.history {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.full {
  grid-column: 1/-1;
}
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
}
input,
select,
textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #cddadb;
  border-radius: 11px;
  padding: 11px 12px;
  min-height: 46px;
  color: inherit;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #337f7e;
  box-shadow: 0 0 0 3px #337f7e15;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  accent-color: var(--teal);
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 400;
  margin: 12px 0;
}
.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 5px;
}
.form-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 20px;
}
.form-section h3 {
  margin-bottom: 12px;
}
.person-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 105px 100px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.person-row.share-row {
  grid-template-columns: 1fr 130px;
}
.person-row .check {
  margin: 0;
}
.person-row input,
.person-row select {
  padding: 9px 7px;
}
.total-preview {
  padding: 15px;
  background: #eaf3ef;
  border-radius: 12px;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.actions button {
  flex: 1;
}
.error {
  color: #b23932;
  background: #fff0ef;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 12px 0;
  font-size: 0.875rem;
}
.error:empty {
  display: none;
}
.login {
  max-width: 440px;
  margin: 7vh auto;
  padding: 0 22px;
}
.login .brand {
  margin-bottom: 48px;
}
.login h1 {
  font-size: 2.4rem;
  margin: 10px 0;
}
.login .card {
  margin-top: 30px;
}
.login label {
  margin-top: 17px;
}
.login button {
  width: 100%;
  margin-top: 24px;
}
.login footer {
  margin-top: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}
.login-art {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.875rem;
}
.login-art span {
  height: 1px;
  width: 34px;
  background: #9fb6b4;
}
dialog {
  border: 0;
  border-radius: 24px;
  padding: 26px;
  width: min(560px, calc(100% - 24px));
  max-height: 90dvh;
  color: inherit;
  box-shadow: 0 30px 90px #10373730;
}
dialog::backdrop {
  background: #0c262b70;
  backdrop-filter: blur(3px);
}
dialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.dialog-head button {
  padding: 6px 12px;
  font-size: 1.3rem;
}
.token-output {
  word-break: break-all;
  background: #e9f3ee;
  padding: 16px;
  border-radius: 12px;
  font-family: monospace;
  user-select: all;
}
.loading {
  text-align: center;
  padding: 30vh 20px;
  color: var(--muted);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: #173b3e;
  color: white;
  padding: 12px 22px;
  border-radius: 14px;
  z-index: 10;
  max-width: 90%;
  box-shadow: 0 4px 20px #0002;
  display: none;
}
.settings-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.settings-item:last-child {
  border: 0;
}
.settings-item button {
  white-space: nowrap;
}
.mono {
  font-variant-numeric: tabular-nums;
}
.hide {
  display: none !important;
}
@media (min-width: 760px) {
  .hero {
    padding: 32px;
  }
  .hero h1 {
    font-size: 3.3rem;
  }
  .shell {
    padding-top: 24px;
  }
  .expense {
    padding: 20px;
  }
  .trip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .trip-card {
    margin: 0;
  }
  .hero-summary {
    max-width: 440px;
  }
  .login {
    margin-top: 8vh;
  }
}
@media (max-width: 420px) {
  .topbar {
    padding: 18px;
  }
  .shell {
    padding: 8px 18px 125px;
  }
  h1 {
    font-size: 1.75rem;
  }
  .hero {
    padding: 22px;
  }
  .form-grid {
    gap: 12px;
  }
  .person-row {
    grid-template-columns: minmax(80px, 1fr) 85px 85px;
    gap: 6px;
  }
  dialog {
    padding: 20px;
  }
  .expense {
    gap: 10px;
    padding: 14px;
  }
  .category-icon {
    width: 36px;
    height: 38px;
  }
  .expense-money .small {
    font-size: 0.75rem;
  }
}
