:root {
  --bg: #f3efe6;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6f675c;
  --line: #e4dccf;
  --accent: #9a4d12;
  --accent-2: #f3e2d2;
  --good: #1f7a46;
  --bad: #a12626;
  --shadow: 0 8px 24px rgba(60, 40, 10, 0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 16px 8px;
}
.brand { font-weight: 700; font-size: 20px; }
.sub { color: var(--muted); font-size: 13px; }
select, input, button, textarea {
  font: inherit;
}
select, input {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
}
#userSwitch { max-width: 180px; }
.tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 8px 16px 12px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}
.tabs button.on {
  background: var(--ink);
  color: #fff;
}
main { padding: 0 16px 40px; max-width: 980px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.dead { opacity: .55; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
button.btn, .btn {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
button.ghost {
  background: var(--accent-2);
  color: var(--ink);
}
button.warn { background: #f8e4e4; color: var(--bad); }
form .fields { display: grid; gap: 8px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.calc { background: #f7f1e6; border-radius: 12px; padding: 10px; display: grid; gap: 4px; }
.combo { position: relative; }
.combo-input { width: 100%; padding-right: 36px; }
.combo-clear {
  position: absolute; right: 6px; top: 6px;
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.combo-drop {
  position: absolute; z-index: 8; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(40, 24, 8, .14);
  max-height: 280px; overflow: auto;
}
.combo-drop button {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #fff; color: var(--ink); border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.combo-drop button.active, .combo-drop button:hover { background: #f6efe4; }
.combo-drop button.create { color: var(--accent); font-weight: 650; }
.toast {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  background: var(--ink); color: white;
  padding: 12px 14px; border-radius: 12px;
}
h2 { margin: 4px 0 12px; font-size: 18px; }
.exp-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 6px; }
@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .v { font-size: 18px; }
}
@media (min-width: 900px) {
  body { font-size: 18px; }
  .brand { font-size: 28px; }
  .top, .tabs, main { padding-left: 32px; padding-right: 32px; }
  main { max-width: 1180px; }
  .tabs button { font-size: 16px; padding: 10px 16px; }
  .card { padding: 22px 24px; }
  .v { font-size: 34px; }
  .k { font-size: 13px; }
  label { font-size: 15px; }
  select, input { padding: 12px 14px; }
  h2 { font-size: 22px; }
  table { font-size: 16px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
