﻿:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #edf7f5;
  --text: #17201d;
  --muted: #64716d;
  --line: #dce5e0;
  --brand: #0f766e;
  --brand-dark: #0b5f58;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --positive: #087443;
  --negative: #a23b20;
  --shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.topbar,
.toolbar,
.panel-heading,
.person-card-header,
.entry-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  align-items: center;
  padding: 8px 0 18px;
}

.toolbar {
  align-items: center;
}

.toolbar p,
.helper,
.person-meta,
.contact-note,
.entry-date,
.value-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar p,
.value-card p,
.contact-note {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

body[data-view="login"] .eyebrow {
  display: none;
}

.view,
.stack,
.entry-form,
.panel {
  display: grid;
  gap: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel,
.person-card,
.profile-card,
.summary-card,
.entry-item,
.empty-state,
.value-card,
.install-hint,
.alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.person-card,
.profile-card,
.summary-card,
.empty-state,
.value-card {
  padding: 16px;
}

.summary-card {
  display: grid;
  gap: 6px;
}

.summary-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-card strong {
  font-size: 1.25rem;
}

.install-hint,
.alert {
  margin-bottom: 14px;
  padding: 14px;
}

.install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
}

.install-hint p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.alert {
  background: #fff8ed;
  color: #8a4b08;
}

.alert[data-tone="success"] {
  background: #eaf8f0;
  color: #087443;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.fab-button,
.icon-button,
.install-hint button {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 830;
}

.primary-button,
.fab-button,
.install-hint button,
.icon-button {
  background: var(--brand);
  color: white;
}

.primary-button {
  width: 100%;
  padding: 0 16px;
}

.secondary-button {
  background: #eff2f0;
  color: var(--text);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.text-button {
  min-height: auto;
  padding: 4px 0;
  background: transparent;
  color: var(--brand-dark);
}

.compact {
  min-height: 40px;
  padding: 0 12px;
}

.fab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  box-shadow: var(--shadow);
}

.fab-button span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.4rem;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  font-size: 1.35rem;
  box-shadow: var(--shadow);
}

.person-card {
  display: grid;
  gap: 14px;
}

.profile-card {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text);
  text-align: left;
}

.profile-card span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.profile-card strong,
.profile-card small {
  overflow-wrap: anywhere;
}

.profile-card small {
  color: var(--muted);
}

.profile-card b {
  flex: 0 0 auto;
  font-size: 1.2rem;
}

.detail-layout {
  display: grid;
  gap: 14px;
}

.value {
  margin: 0;
  white-space: nowrap;
  font-size: 1.75rem;
  font-weight: 920;
}

.value-card {
  display: grid;
  gap: 7px;
}

.value-card .value {
  font-size: 2.45rem;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.entry-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.entries-panel {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.entries-panel summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 830;
}

.inset {
  margin-top: 12px;
}

.entry-item {
  padding: 14px;
}

.entry-date {
  margin-bottom: 0;
}

.entry-value {
  white-space: nowrap;
  font-weight: 920;
}

.entry-value.plus {
  color: var(--positive);
}

.entry-value.minus {
  color: var(--negative);
}

.entry-comment {
  margin: 8px 0 0;
}

.empty-state p,
.helper {
  margin-bottom: 0;
}

[hidden] {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding-inline: 24px;
  }

  h1 {
    font-size: 2.4rem;
  }

  .panel,
  .person-card,
  .empty-state,
  .value-card {
    padding: 20px;
  }

  .person-card {
    gap: 16px;
  }

  .entry-form {
    grid-template-columns: 1fr 1fr;
    align-items: end;
  }

  .entry-form h2 {
    grid-column: 1 / -1;
  }

  .entry-form label:last-of-type {
    grid-column: 1 / -1;
  }

  .entry-form .primary-button {
    grid-column: 1 / -1;
  }
}
