@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --bg: #f7f4ef;
  --ink: #1c1b1a;
  --muted: #5c574f;
  --accent: #d16a3a;
  --card: #ffffff;
  --line: #e2dbd1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Gill Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff3e7, var(--bg));
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 8vw;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.brand span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

main {
  padding: 32px 8vw 64px;
}

.hero {
  padding: 48px;
  border-radius: 24px;
  background: #1c1b1a;
  color: #fdf9f3;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 16px;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.button.ghost {
  background: transparent;
  border: 1px solid #fff;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

button:hover,
.button:hover {
  transform: translateY(-1px);
}

.card {
  background: var(--card);
  padding: 24px;
  border-radius: 18px;
  margin-top: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
}

input,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1rem;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.entry-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.entry-row > label {
  min-width: 200px;
  flex: 1 1 200px;
}

.entry-actions {
  display: flex;
  align-items: flex-end;
  padding-top: 18px;
}

.inline {
  display: inline;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.hint.ok {
  color: #1b7a3a;
}

.hint.error {
  color: #9f2e2e;
}

.input-error {
  border-color: #d46a6a;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-static {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.profile-static div {
  display: grid;
  gap: 4px;
  background: #fff7ef;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.profile-static strong {
  font-size: 0.8rem;
  color: var(--muted);
}

.alert {
  background: #ffe6da;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.profile {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  display: grid;
  gap: 6px;
  min-width: 140px;
}

.stat.wide {
  min-width: 220px;
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.chart-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.chart-empty {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  border: 1px dashed var(--line);
  color: var(--muted);
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
}

.chart-title {
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-card canvas,
.chart-card .chart-body {
  width: 100%;
  height: 220px;
}

.unit-toggle {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


.x-range {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
}

.icon-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.icon-button.danger {
  border-color: #e1a3a3;
  color: #9f2e2e;
}

.date-field {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.date-field input[type="text"] {
  width: 140px;
}

.date-field input[type="date"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.date-field .date-hint {
  display: block;
  width: 100%;
}

.entry-form input[type="number"] {
  width: 140px;
}

td.compact {
  width: 120px;
}

dialog {
  border: none;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

footer {
  padding: 24px 8vw 40px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hero {
    padding: 32px;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }
}
