:root {
  color-scheme: light;
  --ink: #1c2925;
  --muted: #68736f;
  --line: #dce3df;
  --paper: #ffffff;
  --wash: #f4f7f5;
  --accent: #24443a;
  --accent-2: #dbe9e3;
  --danger: #a13a32;
  --shadow: 0 18px 50px rgba(31, 56, 47, 0.10);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--wash); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(100% - 32px, 720px); margin: 0 auto; padding: 52px 0 40px; }
.shell.wide { width: min(100% - 32px, 1180px); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 46px); letter-spacing: -.045em; line-height: 1.08; }
.subtitle { margin: 12px 0 30px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.text-link { color: var(--accent); font-size: 14px; font-weight: 700; text-decoration: none; border-bottom: 1px solid currentColor; white-space: nowrap; }
.card { background: var(--paper); border: 1px solid rgba(36, 68, 58, .08); border-radius: 24px; box-shadow: var(--shadow); padding: clamp(22px, 5vw, 38px); }
.field { display: grid; gap: 9px; }
.field > label, .section-label { color: #3e4c47; font-size: 14px; font-weight: 800; }
.name-input, .search-input, .modal input { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.name-input { height: 58px; padding: 0 17px; font-size: 19px; }
.name-input:focus, .search-input:focus, .modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(36, 68, 58, .11); }
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 26px; }
.money-field { display: grid; gap: 8px; background: #fafcfb; border: 1px solid var(--line); border-radius: 16px; padding: 13px; }
.money-field label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 800; }
.money-field small { color: var(--muted); font-weight: 600; }
.money-field input { width: 100%; min-width: 0; height: 48px; border: 0; border-radius: 10px; background: transparent; outline: none; font-size: 26px; font-weight: 800; text-align: right; }
.quick-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick-steps button { min-width: 0; height: 35px; padding: 0; border: 0; border-radius: 9px; color: var(--accent); background: var(--accent-2); font-size: 13px; font-weight: 900; cursor: pointer; }
.quick-steps button:hover { background: #cbded6; }
.total-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 26px 0 18px; padding: 18px 20px; border-radius: 16px; background: var(--accent); color: #fff; }
.total-panel span { font-size: 14px; font-weight: 700; opacity: .78; }
.total-panel strong { font-size: clamp(24px, 6vw, 35px); letter-spacing: -.035em; }
.primary, .secondary { min-height: 52px; border-radius: 14px; padding: 0 20px; font-weight: 800; cursor: pointer; transition: transform .1s, opacity .15s; }
.primary { width: 100%; border: 0; color: #fff; background: var(--accent); }
.primary:hover, .secondary:hover { transform: translateY(-1px); }
.primary:disabled { cursor: wait; opacity: .55; }
.secondary { border: 1px solid var(--line); color: var(--accent); background: #fff; }
.secondary.compact { min-height: 40px; padding: 0 14px; font-size: 13px; }
.message { min-height: 24px; margin: 12px 2px 0; color: var(--accent); font-size: 14px; font-weight: 700; text-align: center; }
.message.error { color: var(--danger); }
.shortcut-guide { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 15px; margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
kbd { display: inline-block; min-width: 22px; padding: 1px 5px; border: 1px solid #cfd7d3; border-bottom-width: 2px; border-radius: 5px; color: #41514b; background: #f8faf9; font-family: inherit; font-size: 11px; font-weight: 800; text-align: center; }
.cumulative-card { margin-top: 18px; padding: clamp(22px, 5vw, 32px); border: 1px solid rgba(36, 68, 58, .08); border-radius: 24px; background: #e7efeb; }
.cumulative-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.cumulative-head h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.cumulative-head > span { padding: 6px 10px; border-radius: 999px; color: var(--accent); background: rgba(255, 255, 255, .72); font-size: 13px; font-weight: 800; }
.cumulative-total { display: block; margin: 19px 0; color: var(--accent); font-size: clamp(32px, 8vw, 48px); letter-spacing: -.045em; }
.cumulative-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cumulative-grid > div { padding: 13px 10px; border-radius: 12px; background: rgba(255, 255, 255, .72); text-align: center; }
.cumulative-grid span { display: block; color: var(--muted); font-size: 12px; }
.cumulative-grid strong { display: block; margin-top: 4px; font-size: 17px; }
.summary-error { min-height: 0; margin: 9px 0 0; color: var(--danger); font-size: 12px; text-align: center; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 12px; margin: 24px 0 16px; }
.search-wrap { position: relative; }
.search-input { height: 50px; padding: 0 48px 0 16px; }
.clear-search { position: absolute; right: 9px; top: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: pointer; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat { padding: 20px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.stat strong { display: block; margin-top: 5px; font-size: 25px; letter-spacing: -.03em; }
.table-card { overflow: hidden; padding: 0; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 14px 12px; border-bottom: 1px solid #edf0ee; text-align: right; font-size: 14px; }
th { color: #50605a; background: #f7f9f8; font-size: 12px; letter-spacing: .02em; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
.empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.edit-button, .delete-button { border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; background: white; font-weight: 800; cursor: pointer; }
.edit-button { color: var(--accent); }
.delete-button { color: var(--danger); }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.limit-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; text-align: right; }

.modal { width: min(100% - 28px, 620px); border: 0; border-radius: 22px; padding: 0; color: var(--ink); box-shadow: 0 30px 100px rgba(10, 24, 19, .28); }
.modal::backdrop { background: rgba(18, 29, 25, .52); backdrop-filter: blur(3px); }
.modal-inner { padding: 27px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.modal h2 { margin: 0; font-size: 24px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: var(--wash); font-size: 20px; cursor: pointer; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal .field:first-child { grid-column: 1 / -1; }
.modal input { height: 48px; padding: 0 13px; text-align: right; }
.modal .field:first-child input { text-align: left; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.modal-actions .primary { width: auto; }

@media (max-width: 640px) {
  .shell { width: min(100% - 22px, 720px); padding-top: 30px; }
  .money-grid { grid-template-columns: 1fr; }
  .cumulative-grid { grid-template-columns: 1fr 1fr; }
  .card { border-radius: 20px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar .secondary { width: 100%; }
  .topline { align-items: center; }
  .subtitle { margin-bottom: 22px; }
  .edit-grid { grid-template-columns: 1fr; }
  .modal .field:first-child { grid-column: auto; }
  th:nth-child(1), td:nth-child(1), th:nth-child(8), td:nth-child(8) { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
