/* Base — reset, typography, common helpers. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body {
  font-family: var(--f-sans);
  background: var(--bg-0);
  color: var(--tx-1);
  /* Cỡ chữ nền 14px (cũ 13px) và giãn dòng 1.35 (cũ 1.5) — đo trên facebook.com 29/07/2026:
     họ để chữ thân 15px và giãn ~1.30 (15px→20px, 17px→22px). Repo này dày hơn newsfeed nên
     chọn 14px làm bước trung gian: nhảy thẳng 15px là vỡ nhiều bố cục ngang.
     1.5 quá thoáng cho giao diện dày: mắt phải nhảy xa giữa hai dòng của cùng một hàng.
     CỐ Ý chỉ đổi mặc định TOÀN CỤC — mọi khai báo `line-height: 1.5` trở lên đặt riêng trên
     văn bản DÀI (ghi chú, tóm tắt AI, ô soạn tin) vẫn giữ nguyên, vì ở đó thoáng mới dễ đọc. */
  font-size: 14px;
  line-height: 1.35;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Numbers use tabular figures to keep columns aligned */
.num, .mono { font-variant-numeric: tabular-nums; font-family: var(--f-mono); }
.tabular { font-variant-numeric: tabular-nums; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }
::-webkit-scrollbar-track { background: transparent; }

/* Visibility */
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Text utils */
.tx-2 { color: var(--tx-2); }
.tx-3 { color: var(--tx-3); }
.tx-4 { color: var(--tx-4); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Loader */
#loader {
  position: fixed; inset: 0; background: var(--bg-0);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; flex-direction: column; gap: 14px;
}
.spin {
  width: 32px; height: 32px;
  border: 2.5px solid var(--line-2); border-top-color: var(--ac);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadein var(--dur-2) var(--ease); }

/* ---- Tôn trọng "giảm chuyển động" của hệ điều hành ----
   Người bị rối loạn tiền đình / say chuyển động bật cờ này ở cấp HĐH; trước đây app bỏ qua
   hoàn toàn nên panel trượt, fade và spinner vẫn chạy đủ.

   KHÔNG dùng `animation: none` — nó làm phần tử đang chờ animation kết thúc để hiện ra bị
   kẹt ở khung hình đầu (đúng bẫy cũ của cách vá này). Rút thời lượng về gần 0 thì animation
   vẫn CHẠY và vẫn bắn `animationend`/`transitionend`, chỉ là xong ngay.

   Đặt cuối base.css để đè mọi khai báo phía trên; các file css sau (layout/views/drawer) có
   độ đặc hiệu cao hơn nên vẫn cần `!important`. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  /* Spinner là chỉ báo "đang chạy" — bỏ quay là mất nghĩa. Giữ quay nhưng chậm hẳn lại
     để không còn là chuyển động nhanh gây khó chịu. */
  .spin { animation-duration: 3s !important; }
}
