/* Reveal chỉ ẩn khi có JS (an toàn nếu JS tắt/chậm) */
html:not(.js) .reveal { opacity: 1 !important; transform: none !important; }

/* ============================================================ AUTH MODAL ============================================================ */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(40,28,16,0.55); backdrop-filter: blur(3px); }
.modal-overlay.open { display: flex; animation: fadeIn .2s ease both; }
.modal { position: relative; width: 100%; max-width: 460px; background: var(--card); border-radius: 26px; box-shadow: 0 30px 80px rgba(60,40,20,.35); padding: 38px 40px 34px; text-align: center; animation: pop .22s cubic-bezier(.2,.7,.2,1) both; max-height: 92vh; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close { position: absolute; top: 18px; right: 20px; border: none; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--brown); }
.modal-title { font-size: 1.6rem; font-weight: 800; color: var(--brown); }
.modal-sub { margin-top: 6px; font-size: .9rem; color: var(--text-muted); }
.modal-alert { margin: 18px 0 0; padding: 12px 16px; border-radius: 12px; font-size: .85rem; font-weight: 500; display: none; }
.modal-alert.show { display: block; }
.modal-alert.error { background: #FBEAEA; color: #C0392B; }
.modal-alert.success { background: #EAF6EC; color: #2E7D46; }
.seg { display: flex; gap: 4px; margin: 22px auto 20px; background: var(--bg); padding: 5px; border-radius: 14px; }
.seg-btn { flex: 1; border: none; background: transparent; font-family: inherit; font-weight: 700; font-size: .92rem; color: var(--text-muted); padding: 10px; border-radius: 10px; cursor: pointer; transition: all .2s; }
.seg-btn.is-active { background: var(--card); color: var(--brown); box-shadow: var(--shadow-pill); }
.field { width: 100%; margin-bottom: 14px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card-2); font-family: inherit; font-size: .95rem; color: var(--text); }
.field:focus { outline: none; border-color: var(--orange-line); box-shadow: 0 0 0 3px var(--orange-soft); background: var(--card); }
.field::placeholder { color: var(--muted); }
.hidden { display: none !important; }
.btn-dark { display: block; width: 100%; border: none; font-family: inherit; font-weight: 700; font-size: 1rem; color: #fff; padding: 16px; border-radius: 16px; cursor: pointer; background: linear-gradient(180deg, #3a2c20, #2b2018); box-shadow: 0 12px 24px rgba(40,28,16,.28); transition: transform .15s, filter .2s; margin-top: 4px; }
.btn-dark:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-dark:disabled { opacity: .6; cursor: not-allowed; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 1px solid var(--line); font-family: inherit; font-weight: 600; font-size: .95rem; color: var(--brown); padding: 14px; border-radius: 16px; cursor: pointer; background: var(--card); text-decoration: none; }
.btn-google:hover { background: var(--card-2); box-shadow: var(--shadow-pill); }
.modal-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .8rem; }
.modal-or::before, .modal-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.modal-link { margin-top: 18px; font-size: .85rem; color: var(--text-muted); }
.modal-note { margin-top: 20px; font-size: .76rem; line-height: 1.6; color: var(--muted); }

/* ============================================================ PAGE (trang phụ / admin) ============================================================ */
.site-header { position: relative; z-index: 1; border-bottom: 1px solid var(--line); background: rgba(253,251,246,.6); }
.site-header .inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header .brand { font-weight: 800; font-size: 1.1rem; color: var(--brown); }
.site-header .brand span { color: var(--orange); }
.site-header nav { display: flex; gap: 24px; font-size: .9rem; font-weight: 600; }
.site-header nav a { color: var(--text-muted); } .site-header nav a:hover { color: var(--orange); }
.page-wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 40px 24px 70px; }
.page-title { font-size: 1.7rem; font-weight: 800; color: var(--brown); margin-bottom: 6px; }
.page-sub { color: var(--text-muted); margin-bottom: 24px; }
.h2 { font-size: 1.15rem; font-weight: 700; color: var(--brown); margin: 0 0 12px; }
.panel { background: linear-gradient(160deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card); padding: 22px 24px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.muted { color: var(--text-muted); font-size: .88rem; }
.badge { font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #FCE9DA; color: #C4641E; }
.badge.green { background: #EAF6EC; color: #2E7D46; } .badge.gray { background: #F0E9DE; color: #8E7C68; }
.btn-sm { display: inline-block; border: none; font-family: inherit; font-weight: 700; font-size: .85rem; color: #fff; padding: 9px 18px; border-radius: 10px; cursor: pointer; background: var(--orange); text-decoration: none; }
.btn-sm.ghost { background: transparent; color: var(--brown); border: 1px solid var(--line); }
.btn-sm.danger { background: transparent; color: #C0392B; padding: 9px 6px; }
.input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: inherit; font-size: .92rem; margin-bottom: 10px; }
textarea.input { resize: vertical; }
label.chk { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--brown); margin-bottom: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .04em; color: var(--brown); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.admin-side { width: 230px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--card); padding: 22px 18px; }
.admin-side .brand { font-weight: 800; font-size: 1.05rem; color: var(--brown); display: block; margin-bottom: 18px; }
.admin-side .brand span { color: var(--orange); }
.admin-side a { display: block; padding: 9px 12px; border-radius: 9px; color: #6b5d4d; font-weight: 600; font-size: .9rem; }
.admin-side a:hover, .admin-side a.active { background: var(--bg); color: var(--orange); }
.admin-main { flex: 1; min-width: 0; padding: 30px 34px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { background: linear-gradient(160deg, var(--card), var(--card-2)); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.stat b { display: block; font-size: 2rem; color: var(--orange); }
.alert { padding: 12px 16px; border-radius: 12px; font-size: .9rem; margin-bottom: 18px; }
.alert.ok { background: #EAF6EC; color: #2E7D46; } .alert.err { background: #FBEAEA; color: #C0392B; }
@media (max-width: 820px) { .grid2, .stat-grid { grid-template-columns: 1fr; } .admin-side { display: none; } .admin-main { padding: 20px; } }

/* ============================================================ ARTICLE (Markdown) ============================================================ */
.article-body { max-width: 760px; color: var(--text); line-height: 1.75; }
.article-body h1, .article-body h2, .article-body h3 { color: var(--brown); font-weight: 700; margin: 1.4em 0 .5em; line-height: 1.3; }
.article-body h1 { font-size: 1.6rem; } .article-body h2 { font-size: 1.3rem; } .article-body h3 { font-size: 1.1rem; }
.article-body p { margin: 0 0 1em; }
.article-body ul, .article-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.article-body ul { list-style: disc; } .article-body ol { list-style: decimal; }
.article-body li { margin: .3em 0; }
.article-body a { color: var(--orange); font-weight: 600; text-decoration: underline; }
.article-body img { max-width: 100%; border-radius: 12px; margin: 1em 0; }
.article-body code { background: var(--bg-2); padding: .15em .4em; border-radius: 6px; font-size: .9em; }
.article-body pre { background: #2b2018; color: #f6f1ea; padding: 16px; border-radius: 12px; overflow-x: auto; margin: 0 0 1em; }
.article-body pre code { background: transparent; padding: 0; }
.article-body blockquote { border-left: 3px solid var(--orange); padding-left: 1em; color: var(--text-muted); margin: 0 0 1em; }
