:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7f2;
  color: #161a1d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(42, 93, 80, 0.12), transparent 260px),
    #f4f7f2;
}

button,
input,
textarea {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 112px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #586069;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.icon-button,
.close-button {
  display: grid;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #253238;
  box-shadow: 0 8px 24px rgba(29, 42, 37, 0.08);
  font-size: 0.82rem;
  font-weight: 900;
}

.icon-button:active,
.add-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.net-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 18px;
  padding: 18px;
  border: 1px solid rgba(37, 50, 56, 0.1);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(29, 42, 37, 0.08);
}

.net-panel span,
.current-balance span {
  color: #586069;
  font-size: 0.9rem;
}

.net-panel strong {
  font-size: 1.35rem;
}

.people-list {
  display: grid;
  gap: 10px;
}

.person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(37, 50, 56, 0.08);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-align: left;
  box-shadow: 0 10px 24px rgba(29, 42, 37, 0.06);
}

.person-row:active {
  transform: translateY(1px);
}

.person-name {
  display: block;
  font-weight: 800;
}

.person-updated {
  display: block;
  margin-top: 3px;
  color: #66707a;
  font-size: 0.78rem;
}

.balance {
  white-space: nowrap;
  font-weight: 900;
}

.positive {
  color: #12805c;
}

.negative {
  color: #b42318;
}

.neutral {
  color: #586069;
}

.empty-state {
  margin-top: 48px;
  padding: 28px 20px;
  border: 1px dashed rgba(37, 50, 56, 0.25);
  border-radius: 8px;
  text-align: center;
}

.empty-state p {
  margin-bottom: 0;
  color: #66707a;
}

.add-button {
  position: fixed;
  right: max(18px, calc((100vw - 520px) / 2 + 18px));
  bottom: 22px;
  width: min(260px, calc(100vw - 36px));
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.28);
}

.sheet {
  width: min(100% - 28px, 500px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.35);
}

.sheet::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.sheet-content {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.close-button {
  justify-self: end;
  margin: -8px -8px -8px 0;
  box-shadow: none;
}

label {
  display: grid;
  gap: 7px;
  color: #3d4750;
  font-size: 0.9rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #c9d2d9;
  border-radius: 8px;
  padding: 0 13px;
  background: #ffffff;
  color: #161a1d;
  outline: none;
}

input:focus {
  border-color: #2a5d50;
  box-shadow: 0 0 0 3px rgba(42, 93, 80, 0.15);
}

.hint {
  margin: -6px 0 0;
  color: #66707a;
  font-size: 0.84rem;
}

.current-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #f4f7f2;
}

.adjustment-card {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(37, 50, 56, 0.1);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(29, 42, 37, 0.08);
}

.detail-balance {
  align-items: flex-start;
  flex-direction: column;
}

.detail-balance strong {
  font-size: 2.1rem;
}

.detail-mode .add-button {
  display: none;
}

.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: #2a5d50;
  color: #ffffff;
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 92px;
  left: 18px;
  display: none;
  max-width: 484px;
  margin: 0 auto;
  padding: 13px 16px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 0.9rem;
  text-align: center;
}

.toast.visible {
  display: block;
}
