:root {
  --bg: #f5f5f3;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --text: #111111;
  --muted: #707070;
  --muted-soft: #a7a7a7;
  --line: rgba(17, 17, 17, 0.08);
  --line-strong: rgba(17, 17, 17, 0.14);
  --shadow: 0 10px 30px rgba(17, 17, 17, 0.06);
  --tone-normal-bg: rgba(17, 17, 17, 0.05);
  --tone-normal-text: #111111;
  --tone-medium-bg: rgba(17, 17, 17, 0.12);
  --tone-medium-text: #111111;
  --tone-strong-bg: #111111;
  --tone-strong-text: #f5f5f3;
  --warning-bg: rgba(17, 17, 17, 0.1);
  --warning-text: #111111;
  --success-bg: rgba(17, 17, 17, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(17, 17, 17, 0.05), transparent 28%),
    linear-gradient(180deg, #fafaf9 0%, var(--bg) 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.topbar {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -0.05em;
  line-height: 0.92;
}

h2 {
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.subtitle,
.section-meta,
.summary-copy,
.budget-status,
.input-hint,
.expense-note {
  color: var(--muted);
}

.subtitle {
  max-width: 42rem;
  line-height: 1.5;
}

.layout {
  display: grid;
  gap: 24px;
}

.primary-panel,
.summary-panel {
  display: grid;
  gap: 20px;
}

.quick-add-card,
.summary-card,
.insight-card,
.date-group {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow);
}

.quick-add-card,
.summary-card,
.date-group {
  padding: 20px;
  border-radius: var(--radius-xl);
}

.input-label,
.budget-label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.input-wrap,
.budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-add-input,
.budget-input,
.expense-edit-form input {
  width: 100%;
  border: 0;
  outline: 0;
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  color: var(--text);
}

.quick-add-input {
  min-height: 64px;
  padding: 0 20px;
  font-size: clamp(1.05rem, 3vw, 1.3rem);
  letter-spacing: -0.03em;
  box-shadow: inset 0 0 0 1px var(--line);
}

.quick-add-input:focus,
.budget-input:focus,
.expense-edit-form input:focus {
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 0 0 4px rgba(17, 17, 17, 0.05);
}

.ghost-button,
.mini-button {
  flex: 0 0 auto;
  padding: 0 18px;
  min-height: 52px;
  border-radius: 999px;
  background: #111111;
  color: #f7f7f5;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.ghost-button:hover,
.mini-button:hover,
.expense-edit-trigger:hover,
.delete-button:hover {
  transform: translateY(-1px);
}

.ghost-button:active,
.mini-button:active,
.expense-edit-trigger:active,
.delete-button:active {
  transform: translateY(0);
}

.input-hint {
  margin-top: 12px;
  font-size: 0.88rem;
}

.input-hint span {
  color: var(--text);
}

.insights-strip {
  display: grid;
  gap: 12px;
}

.insight-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  min-height: 68px;
  display: flex;
  align-items: center;
  font-size: 0.96rem;
  letter-spacing: -0.02em;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading.compact {
  margin-bottom: 16px;
}

.expense-groups {
  display: grid;
  gap: 16px;
}

.empty-state {
  padding: 24px;
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.date-group {
  display: grid;
  gap: 14px;
}

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

.date-label {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.expense-list {
  display: grid;
  gap: 8px;
}

.expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.expense-row:last-child {
  border-bottom: 0;
}

.expense-main {
  min-width: 0;
}

.expense-edit-trigger {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.expense-amount {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.expense-category {
  color: var(--text);
}

.expense-separator {
  color: var(--muted-soft);
}

.expense-note {
  margin-top: 4px;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-button {
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  color: var(--muted);
  transition: opacity 120ms ease, color 120ms ease, transform 120ms ease;
}

.expense-row:hover .delete-button,
.expense-row:focus-within .delete-button {
  opacity: 1;
  pointer-events: auto;
}

.delete-button:hover {
  color: var(--text);
}

.group-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.tone-pill,
.big-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: background 140ms ease, color 140ms ease;
}

.tone-pill {
  padding: 8px 12px;
  font-size: 0.92rem;
}

.big-total {
  min-height: 64px;
  padding: 0 18px;
  width: fit-content;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  margin-bottom: 10px;
}

.tone-normal {
  background: var(--tone-normal-bg);
  color: var(--tone-normal-text);
}

.tone-medium {
  background: var(--tone-medium-bg);
  color: var(--tone-medium-text);
}

.tone-strong {
  background: var(--tone-strong-bg);
  color: var(--tone-strong-text);
}

.currency-mark {
  font-size: 1.15rem;
  font-weight: 600;
}

.budget-input {
  min-height: 52px;
  padding: 0 18px;
}

.budget-meter {
  width: 100%;
  height: 10px;
  margin: 14px 0 10px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.budget-progress {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #111111;
  transition: width 160ms ease, background 160ms ease;
}

.budget-progress.warning {
  background: rgba(17, 17, 17, 0.6);
}

.breakdown-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.breakdown-row {
  display: grid;
  gap: 6px;
}

.breakdown-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.breakdown-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  border-radius: inherit;
  background: #111111;
}

.expense-edit-form {
  display: grid;
  gap: 10px;
}

.expense-edit-form input {
  min-height: 44px;
  padding: 0 14px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.mini-button {
  min-height: 44px;
  justify-content: center;
}

.mini-button.secondary {
  background: rgba(17, 17, 17, 0.08);
  color: var(--text);
}

@media (min-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.8fr);
    align-items: start;
  }

  .summary-panel {
    position: sticky;
    top: 24px;
  }
}

@media (max-width: 859px) {
  .ghost-button {
    min-width: 84px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 100%);
    padding-top: 24px;
  }

  .quick-add-card,
  .summary-card,
  .date-group {
    padding: 18px;
    border-radius: 24px;
  }

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

  .ghost-button {
    width: 100%;
  }

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

  .delete-button {
    opacity: 1;
    pointer-events: auto;
  }
}
