/* Sổ Tích Lũy — tông màu vàng đồng theo so-tich-luy-mau.html */
:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #232019;
  --ink-soft: #847f73;
  --line: #ebe7dc;
  --gold: #c79a3e;
  --gold-soft: #f6edd6;
  --red: #c14b40;
  --red-soft: #fae3e1;
  --green: #2f7d4f;
  --green-soft: #e3f1e6;
  --shadow: 0 1px 2px rgba(35, 32, 25, .05), 0 6px 22px rgba(35, 32, 25, .06);
}

* { box-sizing: border-box; }

body {
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  padding: 16px;
}

/* ===== Login page ===== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--gold);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand h1 { font-size: 17px; margin: 0; }
.brand p { font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 0 0; }

/* ===== Form elements (chung cho login và home modal) ===== */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
label .req { color: var(--red); }

input[type="password"],
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--gold); }

textarea { resize: vertical; min-height: 60px; }

.btn-primary {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 18px;
  border: none;
  border-radius: 11px;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .92; }

.btn-text {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 11px;
}
.btn-text:hover { color: var(--ink); background: var(--gold-soft); }

/* Trang login dùng <button> nguyên block làm form submit */
.login-page button {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 16px;
  border: none;
  border-radius: 11px;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  margin-top: 14px;
}

.error {
  background: var(--red-soft);
  border: 1px solid #f1c4bf;
  color: var(--red);
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
  margin-bottom: 14px;
}

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

/* ===== Home page ===== */
.container { max-width: 720px; margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.topbar-actions .btn-text { text-decoration: none; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 18px;
}
.empty strong { color: var(--ink); }

/* ===== Filters (chips) ===== */
.filters { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ===== Summary card ===== */
.summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--gold-soft);
  border-radius: 13px;
  padding: 13px 14px;
}
.stat .k { font-size: 11.5px; color: #8a6f3a; font-weight: 600; }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 3px; letter-spacing: -.3px; }
.stat .v small { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.stat .sub { font-size: 11px; color: var(--ink-soft); font-style: italic; margin-top: 2px; }

.pnl-bar {
  margin-top: 11px;
  border-radius: 13px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pnl-bar.win { background: var(--green-soft); }
.pnl-bar.lose { background: var(--red-soft); }
.pnl-bar .lbl { font-size: 14px; font-weight: 700; }
.pnl-bar .amt { font-size: 16px; font-weight: 700; flex: 1; text-align: right; padding-right: 10px; }
.pnl-bar .pct {
  font-size: 13px; font-weight: 700; color: #fff;
  padding: 4px 10px; border-radius: 9px;
}
.win .lbl, .win .amt { color: var(--green); }
.win .pct { background: var(--green); }
.lose .lbl, .lose .amt { color: var(--red); }
.lose .pct { background: var(--red); }

.record-list { list-style: none; padding: 0; margin: 0 0 18px 0; display: flex; flex-direction: column; gap: 10px; }

.rec {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
a.rec:hover { border-color: var(--gold); box-shadow: var(--shadow); }

.rec-icon {
  width: 40px; height: 40px; border-radius: 11px; background: var(--gold-soft);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}

.rec-mid { flex: 1; min-width: 0; }
.rec-brand { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.rec-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.rec-note { font-size: 12px; color: var(--ink-soft); font-style: italic; margin-top: 4px; }

.rec-img-flag { font-size: 13px; margin-left: 4px; }

.img-current { margin-bottom: 8px; }
.img-current img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 11px;
  border: 1px solid var(--line);
  display: block;
}

.rec-amount { text-align: right; flex-shrink: 0; }
.amount-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.amount-value { font-size: 14.5px; font-weight: 700; color: var(--ink); margin-top: 2px; }

.logout-form { margin-top: 24px; text-align: center; }

/* ===== Modal ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal[data-open] { display: flex; align-items: center; justify-content: center; padding: 20px; }
body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: absolute; inset: 0; background: rgba(35, 32, 25, .45);
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 22px 20px 22px;
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

.modal-close {
  background: transparent; border: none; font-size: 24px;
  width: 32px; height: 32px; border-radius: 10px;
  cursor: pointer; color: var(--ink-soft);
}
.modal-close:hover { background: var(--gold-soft); color: var(--ink); }

.field { margin-bottom: 13px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px;
}

.btn-danger {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border: 1px solid var(--red);
  border-radius: 11px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  margin-right: auto;
}
.btn-danger:hover { background: var(--red-soft); }

/* Mobile: row 2 col → 1 col cho điện thoại nhỏ */
@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar .btn-primary { width: 100%; }
}
