/*
 * Reset và kiểu mặc định cho thẻ HTML gốc.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

p {
    margin: 0;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* Vòng focus dùng chung, đủ tương phản trên mọi nền sáng */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Ẩn khỏi màn hình nhưng vẫn đọc được bằng trình đọc màn hình */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tiện ích chữ dùng lặp nhiều nơi */
.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-nowrap {
    white-space: nowrap;
}

.text-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.text-strong {
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

/* Số lượng và tiền tệ luôn canh phải, chữ số đều bề ngang */
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
