* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --paper: #f7f6f1;
  --ink: #17201b;
  --muted: rgba(23, 32, 27, 0.62);
  --line: #dedbd2;
  --leaf: #2f6f4e;
  --mint: #dff0e7;
  --danger: #dc2626;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, "Noto Sans TC", sans-serif;
}

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

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  overflow-x: hidden;
}

.auth-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 20px;
}

.pb-nav {
  padding-bottom: 72px;
}

.pb-actions {
  padding-bottom: 132px;
}

.content {
  padding: 16px 20px;
}

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

.mt-1 {
  margin-top: 4px;
}

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

.p-3 {
  padding: 12px;
}

.p-4 {
  padding: 16px;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.uppercase {
  text-transform: uppercase;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.subcard {
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.field {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  outline: none;
}

.field:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 111, 78, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
}

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

.btn-secondary {
  background: var(--mint);
  color: var(--ink);
}

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

.link-button {
  background: transparent;
  color: var(--leaf);
  padding: 0;
  font-weight: 800;
}

.inline-form {
  display: inline-flex;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 246, 241, 0.96);
  padding: 16px 20px;
  backdrop-filter: blur(10px);
}

.app-header h1,
.auth-title h1,
.card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
}

.app-header p,
.auth-title p,
.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  font-size: 13px;
  font-weight: 900;
}

.header-actions a,
.header-actions .link-button,
.header-actions .filter-toggle-button {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 32px;
  align-items: center;
  padding: 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.ledger-tools[hidden] {
  display: none !important;
}

.header-actions a {
  color: var(--leaf);
}

.header-actions .danger-link {
  color: var(--danger);
}

.header-actions .link-button,
.header-actions .filter-toggle-button {
  background: transparent;
}

.header-actions .filter-toggle-button {
  color: var(--leaf);
}

.bottom-nav,
.quick-actions,
.fixed-actions {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  width: min(100%, 430px);
  margin: 0 auto;
  background: #fff;
}

.bottom-nav {
  bottom: 0;
  display: grid;
  height: 56px;
  border-top: 1px solid var(--line);
}

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

.bottom-nav.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.bottom-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}

.quick-actions,
.fixed-actions {
  bottom: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
}

.fixed-actions {
  grid-template-columns: 3fr 1fr;
  align-items: stretch;
}

.quick-actions .btn-primary,
.quick-actions .btn-secondary,
.quick-actions .btn-danger,
.fixed-actions .btn-primary,
.fixed-actions .btn-secondary {
  line-height: 1;
  text-align: center;
}

.quick-actions .btn-primary,
.quick-actions .btn-secondary,
.quick-actions .btn-danger {
  font-size: 16px;
}

.fixed-actions .btn-primary,
.fixed-actions .btn-secondary {
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

.auth-title {
  margin-bottom: 28px;
}

.auth-title p,
.leaf-label {
  color: var(--leaf);
  font-size: 13px;
  font-weight: 900;
}

.auth-title h1 {
  margin-top: 8px;
  font-size: 30px;
}

.auth-switch {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
}

.auth-switch a {
  color: var(--leaf);
  font-weight: 900;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px 0;
}

.flash {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
}

.flash-success {
  background: var(--mint);
  color: var(--leaf);
}

.flash-error {
  background: #fee2e2;
  color: var(--danger);
}

.group-link,
.member-row,
.trash-row,
.bar-head,
.color-row,
.split-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.split-head {
  margin: 14px 0 4px;
}

.group-link {
  padding: 16px;
}

.group-link h2,
.ledger-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.pill,
.method-pill {
  border-radius: 999px;
  background: var(--mint);
  color: var(--leaf);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
}

.ledger-tools {
  padding-bottom: 8px;
}

.settings-stack {
  gap: 16px;
}

.settings-card {
  gap: 12px;
}

.settings-section-label {
  margin: 0;
  color: rgba(23, 32, 27, 0.6);
  font-size: 14px;
  font-weight: 700;
}

.settings-note,
.settings-disabled-note {
  margin: 0;
  color: rgba(23, 32, 27, 0.6);
  font-size: 14px;
  line-height: 1.5;
}

.settings-member-list {
  gap: 8px;
}

.settings-member-card,
.settings-color-row,
.settings-tag-row {
  border-radius: 8px;
  background: var(--paper);
  padding: 12px;
}

.settings-self-label {
  margin-left: 8px;
  color: rgba(23, 32, 27, 0.5);
  font-size: 12px;
  font-weight: 700;
}

.settings-role {
  color: rgba(23, 32, 27, 0.6);
  font-size: 13px;
  font-weight: 700;
}

.settings-remove-form {
  margin-top: 8px;
}

.settings-remove-link {
  background: transparent;
  padding: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.settings-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-label {
  font-size: 14px;
  font-weight: 700;
}

.settings-color-input {
  width: 56px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.settings-tag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.settings-new-tag-row {
  grid-template-columns: minmax(0, 1fr);
}

.settings-tag-row label {
  min-width: 0;
}

.settings-tag-remove {
  padding-bottom: 11px;
}

.settings-rate-row {
  display: block;
}

.settings-submit-button,
.settings-submit-link {
  font-size: 16px;
  font-weight: 800;
}

.settings-sync-meta {
  margin: 0;
  color: rgba(23, 32, 27, 0.5);
  font-size: 12px;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.radio-chip span {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 800;
}

.chip.active,
.radio-chip input:checked + span {
  border-color: var(--leaf);
  background: var(--leaf);
  color: #fff;
}

.radio-chip input {
  position: absolute;
  opacity: 0;
}

.category-chip-row {
  gap: 10px;
}

.category-chip {
  flex: 0 0 auto;
}

.category-chip span {
  min-height: 0;
  height: 36px;
  border-width: 1px;
  border-radius: 999px;
  background: #fff;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  text-align: center;
  font-weight: 900;
}

.category-chip input:checked + span {
  border-color: var(--leaf);
  background: color-mix(in srgb, var(--leaf) 10%, #fff);
  color: var(--ink);
}

.count-label,
.hint {
  margin: 0;
  color: rgba(23, 32, 27, 0.52);
  font-size: 12px;
  font-weight: 800;
}

.ledger-card {
  position: relative;
  padding: 12px;
  padding-bottom: 38px;
}

.ledger-card-link {
  display: block;
  min-height: 84px;
}

.ledger-card-summary {
  padding-right: 148px;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--leaf);
  line-height: 1.2;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.meta > span:last-child {
  color: rgba(23, 32, 27, 0.52);
  font-weight: 500;
  flex: 0 0 auto;
}

.meta .method-pill {
  color: var(--leaf);
  font-weight: 800;
}

.amount-float {
  position: absolute;
  right: 12px;
  top: 15px;
  max-width: 156px;
  text-align: right;
}

.card-money {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.amount-float small {
  display: block;
  margin-top: 3px;
  color: rgba(23, 32, 27, 0.52);
  font-size: 12px;
  font-weight: 800;
}

.expense-tag {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: var(--leaf);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.share-badges,
.attachment-row,
.attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.share-badge {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  max-width: 94px;
  border: 1px solid;
  border-radius: 4px;
  background: #fff;
  padding: 3px 6px;
  font-size: 9px;
}

.share-badge strong,
.share-badge em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

.share-badge em {
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
}

.attachment-row a,
.attachment-grid a {
  border-radius: 6px;
  background: var(--paper);
  padding: 3px 7px;
  color: var(--leaf);
  font-size: 9px;
  font-weight: 700;
}

.attachment-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.attachment-preview-grid[hidden] {
  display: none !important;
}

.attachment-preview-section h2 {
  margin: 0 0 10px;
}

.attachment-preview-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: var(--ink);
}

.attachment-preview-media,
.attachment-preview-filetype {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--paper);
  aspect-ratio: 4 / 3;
}

.attachment-preview-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-filetype {
  color: var(--leaf);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.attachment-preview-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.ledger-card-corners {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.ledger-entry-meta {
  display: block;
  margin: 0 0 0 auto;
  color: rgba(23, 32, 27, 0.5);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.card-delete-form {
  margin: 0;
}

.card-delete-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  background: transparent;
  padding: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
}

.amount-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
}

.two-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.form-label {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 900;
}

.member-grid,
.share-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.member-grid input {
  position: absolute;
  opacity: 0;
}

.member-grid span {
  display: block;
  overflow: hidden;
  border: 1px solid var(--member-color);
  border-radius: 6px;
  background: #fff;
  padding: 10px 8px;
  color: var(--member-color);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 900;
}

.member-grid input:checked + span {
  background: var(--member-color);
  color: #fff;
}

.split-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.split-modes .card {
  position: relative;
  padding: 12px 8px;
  text-align: center;
  font-weight: 900;
}

.split-modes .card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-card {
  display: grid;
  grid-template-rows: 20px 38px;
  align-content: start;
  row-gap: 6px;
  position: relative;
  min-height: 92px;
  border: 2px solid color-mix(in srgb, var(--member-color) 82%, #fff);
  border-radius: 6px;
  background: #fff;
  padding: 11px 12px;
}

.split-box-hide-checkboxes .share-card [data-share-user] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-card:has(input[type="checkbox"]:checked) {
  border-color: color-mix(in srgb, var(--member-color) 88%, #fff);
  box-shadow: inset 0 0 0 1px var(--member-color);
  background: color-mix(in srgb, var(--member-color) 12%, #f8fbf7);
}

.share-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--member-color);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 900;
  line-height: 20px;
}

.share-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
}

.split-box:has([data-split-mode][value="ratio"]:checked) .share-card {
  grid-template-rows: 20px 38px 16px;
  min-height: 112px;
}

.share-card small {
  display: block;
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
}

.share-card small:empty {
  display: none;
}

.big-money {
  margin: 4px 0 12px;
  font-size: 30px;
  font-weight: 900;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.month-bars {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 160px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.month-bars div {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 140px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.month-bars span {
  display: block;
  min-height: 0;
  border-radius: 7px 7px 0 0;
  background: var(--leaf);
}

.month-bars em {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.invite-code {
  margin: 8px 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 3px;
}

.color-row {
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 12px;
  font-weight: 900;
}

.color-row input {
  width: 58px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trash-row {
  align-items: flex-start;
}

ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

@supports not selector(:has(*)) {
  .share-card {
    border-width: 2px;
  }
}

@media (max-width: 360px) {
  .app-header {
    flex-direction: column;
  }

  .ledger-card-link {
    padding-right: 0;
  }

  .amount-float {
    position: static;
    margin: 8px 0;
    max-width: none;
    text-align: left;
  }
}

.offline-cache-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  width: min(100%, 430px);
  margin: 0 auto;
  background: #fff7ed;
  color: #9a3412;
  border-bottom: 1px solid #fed7aa;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.offline-queue-banner {
  position: sticky;
  top: 0;
  z-index: 31;
  width: min(100%, 430px);
  margin: 0 auto;
  background: #ecfdf5;
  color: #166534;
  border-bottom: 1px solid #bbf7d0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.offline-disabled-link {
  pointer-events: none;
  opacity: 0.62;
}

.offline-readonly-form {
  opacity: 0.72;
}

.offline-readonly-form button,
.offline-readonly-form input,
.offline-readonly-form select,
.offline-readonly-form textarea {
  pointer-events: none;
}

.offline-queued-card {
  border-style: dashed;
  background: #f0fdf4;
}

html {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a,
button,
label,
input,
select,
textarea,
[role="button"],
.btn-primary,
.btn-secondary,
.btn-danger,
.chip,
.radio-chip span,
.member-grid span,
.share-card,
.bottom-nav a,
.ledger-card-link {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(47, 111, 78, 0.55);
  outline-offset: 2px;
}

.page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #2f6f4e, #0891b2, #2f6f4e);
  background-size: 200% 100%;
  animation: page-loading-slide 0.8s linear infinite;
}

@keyframes page-loading-slide {
  from { background-position: 0 0; }
  to { background-position: 200% 0; }
}

.is-submitting {
  opacity: 0.72;
  pointer-events: none;
}

.money-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28em;
  max-width: 100%;
  white-space: nowrap;
  letter-spacing: 0;
}

.money-currency {
  flex: 0 0 auto;
  font-size: 0.66em;
  font-weight: 850;
  color: rgba(23, 32, 27, 0.62);
}

.money-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.money-sign,
.money-whole,
.money-decimal {
  display: inline-block;
}

.money-decimal {
  font-size: 0.82em;
}

.card-money {
  display: inline-flex;
  max-width: 156px;
  font-size: 18px;
  line-height: 1.05;
}

.card-money .money-sign {
  font-size: 0.8em;
  font-weight: 800;
}

.card-money .money-whole {
  font-size: 2.08em;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.card-money .money-decimal {
  font-size: 0.82em;
  color: #000;
}

.amount-float {
  max-width: 164px;
}

.amount-float small {
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.big-money {
  font-size: 28px;
  line-height: 1.08;
}

.muted,
.app-header p,
.auth-title p {
  font-size: 12px;
}

.leaf-label,
.header-actions,
.bottom-nav a,
.auth-switch,
.meta,
.count-label,
.hint {
  font-size: 12px;
}

.chip,
.radio-chip span,
.member-grid span,
.form-label,
.field,
.btn-primary,
.btn-secondary,
.btn-danger {
  font-size: 13px;
}

.group-link h2,
.ledger-card h2 {
  font-size: 16px;
  line-height: 1.15;
}

.share-badge {
  font-size: 9px;
}

.method-pill,
.pill {
  font-size: 10px;
}

.ledger-card h2 {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.12;
}

.ledger-card .muted {
  margin-top: 3px;
  font-size: 13px;
  color: rgba(23, 32, 27, 0.6);
}


.theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 4px;
}

.theme-toggle button {
  min-height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.theme-toggle button.active {
  background: var(--leaf);
  color: #fff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101815;
  --ink: #edf5ef;
  --muted: rgba(237, 245, 239, 0.66);
  --line: #2f3f36;
  --leaf: #69b684;
  --mint: #1f3a2b;
  --danger: #fb7185;
  --surface: #17221d;
  --surface-soft: #111f19;
  --field: #0d1512;
  --muted-strong: rgba(237, 245, 239, 0.82);
  --surface-raised: #1d2b25;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .phone-shell {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .app-header {
  background: rgba(16, 24, 21, 0.94);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .quick-actions,
html[data-theme="dark"] .fixed-actions,
html[data-theme="dark"] .attachment-preview-card,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .stats-card {
  background: var(--surface);
}

html[data-theme="dark"] .subcard,
html[data-theme="dark"] .settings-member-card,
html[data-theme="dark"] .settings-color-row,
html[data-theme="dark"] .settings-tag-row,
html[data-theme="dark"] .share-card,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .bar,
html[data-theme="dark"] .offline-queued-card {
  background: var(--surface-soft);
}

html[data-theme="dark"] .field,
html[data-theme="dark"] .share-input,
html[data-theme="dark"] .settings-color-input,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--field);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .btn-secondary {
  background: var(--mint);
  color: var(--ink);
}

html[data-theme="dark"] .radio-chip span,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .expense-tag,
html[data-theme="dark"] .attachment-preview-filetype {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .radio-chip input:checked + span,
html[data-theme="dark"] .chip.active {
  background: color-mix(in srgb, var(--leaf) 22%, var(--surface));
  border-color: var(--leaf);
  color: var(--ink);
}

html[data-theme="dark"] .flash-success,
html[data-theme="dark"] .offline-queue-banner {
  background: #10291c;
  border-color: #1f6a3d;
  color: #a7f3d0;
}

html[data-theme="dark"] .flash-error,
html[data-theme="dark"] .offline-cache-banner {
  background: #321514;
  border-color: #7f1d1d;
  color: #fecaca;
}

html[data-theme="dark"] img {
  filter: brightness(0.92);
}


html[data-theme="dark"] .settings-section-label,
html[data-theme="dark"] .settings-note,
html[data-theme="dark"] .settings-disabled-note,
html[data-theme="dark"] .settings-self-label,
html[data-theme="dark"] .settings-role,
html[data-theme="dark"] .settings-sync-meta,
html[data-theme="dark"] .count-label,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .amount-float small,
html[data-theme="dark"] .month-bars em,
html[data-theme="dark"] .auth-switch,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .ledger-card .muted,
html[data-theme="dark"] .share-card small {
  color: var(--muted-strong);
}

html[data-theme="dark"] .money-currency,
html[data-theme="dark"] .money-decimal,
html[data-theme="dark"] .card-money .money-decimal,
html[data-theme="dark"] .amount-float small .money-inline,
html[data-theme="dark"] .bar-head span .money-inline {
  color: var(--muted-strong);
}

html[data-theme="dark"] .money-whole,
html[data-theme="dark"] .money-sign,
html[data-theme="dark"] .card-money .money-whole,
html[data-theme="dark"] .big-money .money-whole {
  color: var(--ink);
}

html[data-theme="dark"] .share-badge,
html[data-theme="dark"] .attachment-row a,
html[data-theme="dark"] .attachment-grid a,
html[data-theme="dark"] .settings-member-card,
html[data-theme="dark"] .settings-color-row,
html[data-theme="dark"] .settings-tag-row,
html[data-theme="dark"] .subcard,
html[data-theme="dark"] .bar,
html[data-theme="dark"] .theme-toggle {
  background: var(--surface-raised);
  border-color: var(--line);
}

html[data-theme="dark"] .share-badge em,
html[data-theme="dark"] .share-badge strong,
html[data-theme="dark"] .attachment-row a,
html[data-theme="dark"] .attachment-grid a {
  color: var(--ink);
}

html[data-theme="dark"] .share-card {
  background: var(--surface-raised);
  border-color: color-mix(in srgb, var(--member-color) 58%, var(--line));
}

html[data-theme="dark"] .share-card:has(input[type="checkbox"]:checked) {
  background: color-mix(in srgb, var(--member-color) 18%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--member-color) 78%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--member-color) 80%, #fff);
}

html[data-theme="dark"] .share-input,
html[data-theme="dark"] .settings-color-input,
html[data-theme="dark"] .color-row input {
  background: var(--field);
}

html[data-theme="dark"] .category-chip input:checked + span,
html[data-theme="dark"] .radio-chip input:checked + span,
html[data-theme="dark"] .chip.active,
html[data-theme="dark"] .theme-toggle button.active {
  color: #07110d;
}


html[data-theme="dark"] .member-grid span {
  background: var(--surface-raised);
  border-color: color-mix(in srgb, var(--member-color) 62%, var(--line));
  color: color-mix(in srgb, var(--member-color) 68%, #ffffff);
}

html[data-theme="dark"] .member-grid input:checked + span {
  background: color-mix(in srgb, var(--member-color) 72%, var(--surface));
  border-color: color-mix(in srgb, var(--member-color) 86%, #ffffff);
  color: #07110d;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--member-color) 86%, #ffffff);
}
