:root {
  --bg: #f4efe6;
  --panel: #fff9f0;
  --ink: #2f241d;
  --line: #dccbb5;
  --accent: #a95d2d;
  --income: #1f7a49;
  --expense: #b53d2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: linear-gradient(135deg, #f7f2eb, #efe4d4);
  color: var(--ink);
}

.container {
  width: min(1100px, 92vw);
  margin: 24px auto 40px;
  display: grid;
  gap: 16px;
}

.hero {
  background: #3b2c22;
  color: #fff6ee;
  border-radius: 18px;
  padding: 20px;
}

.hero h1 {
  margin: 0 0 8px;
}

.hero p {
  margin: 0;
  opacity: 0.9;
}

.sync-status {
  margin-top: 10px !important;
  font-size: 13px;
  color: #f2e7dc;
  opacity: 0.95;
}

.auth-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.panel h2 {
  margin-top: 0;
}

.menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-btn {
  background: #6f4f3b;
}

.menu-btn.active {
  background: #2f241d;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.entry-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.entry-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

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

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fffdf9;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.95);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.month-filter {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

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

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

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.bar-chart {
  height: 170px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: end;
}

.bar-group {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.bar-group span {
  font-size: 11px;
  color: #6f5b4b;
}

.bar-pair {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: end;
  gap: 4px;
}

.bar {
  flex: 1;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
}

.income-bar {
  background: #2c8f59;
}

.expense-bar {
  background: #d95a4e;
}

.line-chart {
  height: 170px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  border-bottom: 1px dashed var(--line);
  align-items: end;
}

.line-point-wrap {
  position: relative;
  height: 150px;
}

.line-point {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #2f78c4;
}

.line-point-wrap span {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #6f5b4b;
}

.stack-chart {
  display: grid;
  gap: 8px;
}

.stack-row {
  display: grid;
  grid-template-columns: 86px 1fr 88px;
  gap: 8px;
  align-items: center;
}

.stack-row span {
  font-size: 12px;
  color: #5a4a3f;
}

.stack-row strong {
  font-size: 12px;
  text-align: right;
}

.stack-track {
  background: #f2e7d8;
  border-radius: 999px;
  overflow: hidden;
  height: 12px;
}

.stack-fill {
  height: 100%;
}

.fill-1 { background: #b45134; }
.fill-2 { background: #2f78c4; }
.fill-3 { background: #2f8f59; }
.fill-4 { background: #b27a2b; }
.fill-5 { background: #3d8a8f; }

.chart-empty {
  margin: 0;
  font-size: 13px;
  color: #7f6e5f;
}

.top-gap {
  margin-top: 12px;
}

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

.card h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.card p {
  margin: 0;
  font-weight: 800;
  font-size: 20px;
}

.income p {
  color: var(--income);
}

.expense p {
  color: var(--expense);
}

.balance p {
  color: #1c4c8a;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

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

tbody tr:hover {
  background: #fff6ea;
}

.danger {
  background: #7f2a2a;
}

.ghost {
  background: #5e4f43;
}

.empty-msg {
  margin: 12px 0 0;
  font-size: 14px;
  color: #7f6e5f;
}

.hint {
  font-size: 13px;
  color: #6f5b4b;
}

.hidden {
  display: none !important;
}

@media (max-width: 700px) {
  .container {
    width: 94vw;
    margin-top: 14px;
  }

  .panel {
    padding: 12px;
  }
}
