/* framework-tine-dao — CSS nền tảng. Đổi biến màu ở :root cho từng dự án. */
:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-success: #15803d;
    --color-success-bg: #dcfce7;
    --color-error: #b91c1c;
    --color-error-bg: #fee2e2;
    --color-warning: #a16207;
    --color-warning-bg: #fef9c3;
    --color-info: #1d4ed8;
    --color-info-bg: #dbeafe;
    --radius: 8px;
    --container: 1140px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--color-text); background: var(--color-bg); display: flex; flex-direction: column; min-height: 100vh; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: #eef2f7; padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--color-muted); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 40px; }

/* Header / footer */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--color-text); }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--color-muted); }
.nav a.active, .nav a:hover { color: var(--color-primary); text-decoration: none; }
.nav-user { font-weight: 600; }
.site-footer { border-top: 1px solid var(--color-border); padding: 16px 0; color: var(--color-muted); font-size: 14px; background: var(--color-surface); }

/* Khối */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.hero { padding: 24px 0; }
.list { padding-left: 20px; margin: 0; }
.list li { margin: 4px 0; }

/* Form */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: inherit; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--color-primary) 35%, transparent); border-color: var(--color-primary); }
.field-error { color: var(--color-error); font-size: 13px; margin-top: 4px; }
form.inline { display: inline; margin: 0; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); cursor: pointer; }
.btn:hover { text-decoration: none; background: #f1f5f9; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-block { width: 100%; }
.btn:disabled, .btn.loading { opacity: .6; pointer-events: none; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--color-muted); cursor: pointer; }
button.link:hover { color: var(--color-primary); }

/* Thông báo */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-error { background: var(--color-error-bg); color: var(--color-error); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.alert-info { background: var(--color-info-bg); color: var(--color-info); }

/* Toast (app.js → toast()) */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 9999; pointer-events: none; }
.toast { pointer-events: auto; max-width: 360px; padding: 12px 16px; border-radius: var(--radius); background: var(--color-text); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: 14px; animation: toast-in .2s ease-out; }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-error); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Phân trang */
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0; }
.page-link { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text); }
.page-link:hover { text-decoration: none; border-color: var(--color-primary); }
.page-link.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.page-link.disabled, .page-link.dots { color: var(--color-muted); pointer-events: none; }
.page-link.dots { border-color: transparent; background: none; }

/* Trang đăng nhập / lỗi */
.auth-box { max-width: 400px; margin: 40px auto; }
.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; }
.error-code { font-size: 72px; font-weight: 800; line-height: 1; color: var(--color-primary); }
.error-message { color: var(--color-muted); margin: 12px 0 24px; }
