:root {
  --gold: #b8925a;
  --gold-dark: #8f6f42;
  --ink: #1c1a17;
  --paper: #faf8f5;
  --line: #e7e1d8;
  --muted: #837c70;
  --good: #1f7a4c;
  --bad: #b4392f;
  --card: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--ink);
  color: #fff;
}

header.topbar .brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
header.topbar .brand span { color: var(--gold); }

header.topbar .status {
  font-size: 12px;
  color: #cfc9be;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #6b7280; display: inline-block; }
.dot.synced { background: var(--good); }
.dot.saving { background: var(--gold); }
.dot.error { background: var(--bad); }

nav.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: #24211c;
}
nav.tabs button {
  background: transparent;
  border: none;
  color: #c9c2b4;
  padding: 12px 16px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
nav.tabs button:hover { color: #fff; }
nav.tabs button.active {
  color: #fff;
  border-bottom-color: var(--gold);
  font-weight: 600;
}

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 {
  font-size: 15px;
  margin: 0 0 14px;
  font-weight: 700;
}
.card h3 {
  font-size: 13px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-weight: 700;
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
input, select, textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
input[readonly] { background: #f4f1ec; color: var(--muted); }

button.btn {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
button.btn:hover { background: #33302a; }
button.btn.gold { background: var(--gold); }
button.btn.gold:hover { background: var(--gold-dark); }
button.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.btn.ghost:hover { background: #f2efe9; }
button.btn.danger { background: #fff; color: var(--bad); border: 1px solid #f0c9c5; }
button.btn.danger:hover { background: #fdecea; }
button.btn.sm { padding: 5px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table th {
  text-align: left;
  padding: 8px 8px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--card);
}
table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
table td input, table td select { min-width: 70px; padding: 5px 6px; font-size: 12.5px; }
table tr:hover td { background: #faf7f2; }

.table-scroll { overflow-x: auto; max-height: 70vh; overflow-y: auto; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.pill.good { background: #e6f4ec; color: var(--good); }
.pill.bad { background: #fbeaea; color: var(--bad); }

.category-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.category-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
}
.category-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.category-tabs .add-cat {
  border-style: dashed;
  color: var(--muted);
}

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.small-note { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.summary-strip { display: flex; gap: 24px; margin-bottom: 4px; flex-wrap: wrap; }
.summary-strip .item { min-width: 120px; }
.summary-strip .item .label { font-size: 11.5px; color: var(--muted); }
.summary-strip .item .value { font-size: 19px; font-weight: 700; }

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 4px;
}
.icon-btn:hover { color: var(--bad); }

.settings-list { display: flex; flex-direction: column; gap: 6px; }
.settings-row { display: flex; gap: 8px; align-items: center; }
.settings-row input { flex: 1; min-width: 0; }
.settings-row .icon-btn { flex: 0 0 auto; }

.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.drop-zone.drag { border-color: var(--gold); background: #fbf6ee; }

footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 30px 0 40px; }
