/* Sổ thu chi: những phần mà class Tailwind sẽ phải lặp lại (trường nhập, segmented control, chip, hộp thoại).
   Cùng bảng màu với shared/js/tailwind-theme.js. */

/* Trang không tải shared/css/app.css, và rule [hidden] của chính Tailwind thua một utility display (flex,
   grid) trên cùng element: hidden phải thắng ở mọi nơi, như app.css làm. */
[hidden] { display: none !important; }

.tc-money { font-variant-numeric: tabular-nums; }

/* "000", "k", "tr" bên cạnh số tiền. */
.tc-unit-btn {
  min-width: 44px; min-height: 44px; padding: 0 10px; flex-shrink: 0;
  border: 1px solid #d7c8b7; border-radius: 14px; background: #f3ece2;
  font-size: 0.9rem; font-weight: 600; color: #2b231e;
  transition: background 0.15s, border-color 0.15s;
}
.tc-unit-btn:hover { border-color: #9c4728; background: #efe2d3; }
/* Điện thoại nhỏ: hẹp hơn, để ví dụ của số tiền ("45.000, 45k, 1tr2") không bị cắt. */
@media (max-width: 399px) { .tc-unit-btn { min-width: 40px; padding: 0 6px; } }

.tc-label { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; font-weight: 500; color: #2b231e; }

.tc-field {
  border: 1px solid #d7c8b7;
  border-radius: 14px;
  background: #faf6f0;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 400;
  color: #2b231e;
  min-height: 44px;
}
.tc-field::placeholder { color: #71645a; }
.tc-field:focus { outline: none; border-color: #9c4728; box-shadow: 0 0 0 3px rgb(156 71 40 / 0.2); }

.tc-icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 999px; border: 1px solid #d7c8b7; background: #faf6f0;
  font-size: 1.15rem; line-height: 1; color: #2b231e;
  transition: background 0.15s, border-color 0.15s;
}
.tc-icon-btn:hover:not(:disabled) { background: #f3ece2; border-color: #9c4728; }
.tc-icon-btn:disabled { opacity: 0.35; cursor: default; }

.tc-segment { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: #efe2d3; }
.tc-segment button {
  border-radius: 999px; padding: 8px 14px; min-height: 40px;
  font-size: 0.85rem; font-weight: 500; color: #65584e; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tc-segment button[aria-pressed="true"] { background: #faf6f0; color: #2b231e; box-shadow: 0 1px 3px rgb(43 35 30 / 0.12); }
/* Rộng hết cỡ trên điện thoại: các nút chia hàng theo độ dài chữ của chúng. */
.tc-segment.is-full { display: flex; width: 100%; }
.tc-segment.is-full button { flex: 1 1 auto; padding: 8px 10px; }
@media (min-width: 640px) { .tc-segment.is-full.sm\:w-auto { width: auto; } }
@media (max-width: 399px) { .tc-segment.is-full button { font-size: 0.8rem; padding: 8px 6px; } }

/* Tiền mặt và chuyển khoản phải luôn tách biệt rõ: xanh lá với 💵 cho tiền mặt, màu đất sét với 🏦 cho chuyển
   khoản. Biểu tượng và chữ mang ý nghĩa, màu chỉ để hỗ trợ. */
.tc-method {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  border-radius: 999px; padding: 1px 8px;
  font-size: 0.7rem; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.tc-method.is-cash { background: #e3f1e7; color: #245c38; }
.tc-method.is-transfer { background: #efe2d3; color: #2b231e; }
.tc-method.is-large { padding: 4px 12px; font-size: 0.85rem; }

.tc-method-tile {
  display: block; width: 100%; text-align: left;
  border-radius: 24px; padding: 14px 16px; border: 1px solid transparent;
  transition: box-shadow 0.15s, background 0.15s;
}
.tc-method-tile.is-transfer { background: #fff; border-color: #e8ded2; }
.tc-method-tile.is-cash { background: #e3f1e7; border-color: #c9e3d1; }
.tc-method-tile:hover { box-shadow: 0 8px 20px -14px rgb(43 35 30 / 0.5); }
.tc-method-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #9c4728; }
.tc-method-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-size: 1rem; }
.is-transfer .tc-method-icon { background: #efe2d3; }
.is-cash .tc-method-icon { background: #fff; }

/* "Thêm khoản": hai nút phương thức lớn ở trên cùng. */
.tc-method-pick {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; border-radius: 18px; border: 2px solid #e8ded2; background: #faf6f0;
  font-size: 0.95rem; font-weight: 600; color: #65584e;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.tc-method-pick.is-cash[aria-pressed="true"] { border-color: #3f8f5a; background: #e3f1e7; color: #245c38; }
.tc-method-pick.is-transfer[aria-pressed="true"] { border-color: #9c4728; background: #efe2d3; color: #2b231e; }

/* Điện thoại: "+ 💵" nổi phía trên danh sách. */
.tc-fab {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20; min-width: 64px; height: 56px; padding: 0 20px;
  border-radius: 999px; background: #9c4728; color: #fff; font-size: 1.05rem; font-weight: 600;
  box-shadow: 0 14px 30px -12px rgb(122 54 29 / 0.8);
  transition: background 0.15s, transform 0.15s;
}
.tc-fab:hover { background: #7a361d; }
.tc-fab:active { transform: scale(0.95); }
/* Chân trang ở đáy trang: các dòng của nó nằm bên trái nút. */
@media (max-width: 639px) { site-footer > footer > div[class] { padding-right: 112px; } }

.tc-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  border: 1px solid #d7c8b7; border-radius: 999px; background: #faf6f0;
  padding: 7px 12px; font-size: 0.85rem; color: #2b231e;
  transition: background 0.15s, border-color 0.15s;
}
.tc-chip:hover { border-color: #9c4728; }
.tc-chip[aria-pressed="true"] { background: #9c4728; border-color: #9c4728; color: #fff; }

/* Một hàng của danh sách. */
.tc-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 18px; text-align: left;
  transition: background 0.15s;
}
.tc-row:hover, .tc-row:focus-visible { background: #f3ece2; }
.tc-row-icon { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px; background: #efe2d3; font-size: 1.2rem; }
.tc-row-icon.is-unsorted { background: #ffe2a8; }
/* Điện thoại: số tiền cạnh tên; danh mục và ghi chú, rồi cách thanh toán và thời gian, mỗi thứ một dòng riêng
   trên cả hàng, để ghi chú không bị cắt chỉ còn một hai chữ. */
@media (max-width: 639px) {
  .tc-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 0 12px; }
  .tc-row .tc-row-body, .tc-row .tc-row-side { display: contents; }
  .tc-row .tc-row-icon { grid-row: 1 / span 3; }
  .tc-row .tc-row-name { grid-column: 2; grid-row: 1; }
  .tc-row .tc-row-amount { grid-column: 3; grid-row: 1; text-align: right; }
  .tc-row .tc-row-sub { grid-column: 2 / span 2; grid-row: 2; }
  .tc-row .tc-row-meta { grid-column: 2 / span 2; grid-row: 3; justify-content: flex-start; margin-top: 4px; }
}
.tc-tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 0.7rem; font-weight: 600; }
.tc-tag.is-unsorted { background: #ffe2a8; color: #2b231e; }

/* Tiền chi theo danh mục: mỗi danh mục một thanh, một tông màu (thể hiện độ lớn, không phải danh tính). */
.tc-bar-track { height: 10px; border-radius: 999px; background: #e2cdb8; overflow: hidden; }
.tc-bar { height: 100%; border-radius: 999px; background: #9c4728; transition: width 0.4s ease; }
.tc-bar-btn { display: block; width: 100%; border-radius: 12px; padding: 4px 6px; margin: -4px -6px; text-align: left; transition: background 0.15s; }
.tc-bar-btn:hover, .tc-bar-btn:focus-visible { background: rgb(250 246 240 / 0.7); }
.tc-bar-btn[aria-pressed="true"] { background: #faf6f0; box-shadow: inset 0 0 0 1px #9c4728; }

.tc-dialog {
  width: min(32rem, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  border: 0; border-radius: 28px; padding: 24px;
  background: #faf6f0; color: #2b231e;
  box-shadow: 0 30px 60px -20px rgb(43 35 30 / 0.45);
}
.tc-dialog::backdrop { background: rgb(36 28 23 / 0.45); backdrop-filter: blur(2px); }
@media (max-width: 639px) {
  /* Điện thoại: một sheet trượt từ dưới lên. */
  .tc-dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 28px 28px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
