/* NIPNOTIQ — giao diện kiểu Patreon: nền sáng mặc định, chuyển tối, thẻ bo 12px, nút/tab dạng viên thuốc.
   Màu lấy từ theme-tokens.css (--k-*); file này chỉ lo hình khối và bố cục theo mock đã chốt. */
:root{color-scheme:light;--radius:12px;--shadow:0 1px 2px rgba(23,18,29,.04),0 10px 28px rgba(23,18,29,.06);--pill:8px;--surface-card:var(--k-111116)}
:root[data-theme=dark]{color-scheme:dark;--shadow:none;--surface-card:var(--k-111116)}
/* Phông chữ: ngăn xếp hệ thống giống Patreon (không tải phông ngoài, hợp CSP); Thái dùng Leelawadee/Tahoma */
:root{--font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Hiragino Sans","Yu Gothic UI","Microsoft JhengHei","Microsoft YaHei",sans-serif;--display:var(--font)}
:root:lang(th){--font:-apple-system,BlinkMacSystemFont,"Segoe UI","Leelawadee UI",Tahoma,"Noto Sans Thai",sans-serif;--display:var(--font)}
body{background:var(--bg);color:var(--text);font-size:15px;line-height:1.6;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
/* Bọc trong :root để thắng độ ưu tiên của CSS nạp muộn theo từng trang (gallery.css...). */
:root{

/* Chữ */
h1,h2,h3,h4{font-weight:700;letter-spacing:-.025em;line-height:1.2}
button,input,select,textarea{font-family:inherit}
.button,.nav a,.mobile-tab,.admin-nav-link{letter-spacing:0}
.eyebrow{letter-spacing:.14em;font-weight:700}

/* Hình khối */
.panel,.help-card,.job-card,.empty-state,.stat-card,.auth-wrap,.choice,.dropzone,.form-feedback,.inline-note,dialog,.toast,.pre-wrap{border-radius:var(--radius)}
.panel,.stat-card,.job-card,.help-card,.auth-wrap{background:var(--surface-card);box-shadow:var(--shadow)}
input,select,textarea{border-radius:8px}
.button,.filter,.pill-button{border-radius:var(--pill)}
.button{font-weight:700}
.balance-pill,.section-tag,.icon-chip,.language-control select{border-radius:var(--pill)}
.avatar{border-radius:50%}
.icon-chip{display:inline-grid;place-items:center;width:38px;height:38px;border:1px solid var(--line);background:var(--surface-card);color:var(--muted);cursor:pointer;padding:0}
.icon-chip:hover{border-color:var(--teal);color:var(--text)}
.icon-chip .icon{width:18px;height:18px}

/* Header: dính trên, mờ nền, tab dạng viên thuốc */
.site-header{position:sticky;top:0;z-index:30;height:auto;min-height:68px;background:color-mix(in srgb,var(--bg) 86%,transparent);backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
.header-inner{gap:22px}
.brand{font-weight:800;letter-spacing:.04em}
.nav{gap:4px}
.nav a{padding:8px 16px;border-radius:var(--pill);font-size:13px;font-weight:600;color:var(--muted);transition:background .15s,color .15s}
.nav a:hover{background:var(--surface-card);color:var(--text)}
.nav a.active{background:var(--text);color:var(--bg)}
.nav a.active:after{display:none}
.header-actions{gap:8px}
.mobile-tabbar{display:none}

/* Trang gallery */
.gallery-heading{padding:8px 0 28px;border-bottom:0}
.gallery-heading h1{font-size:clamp(28px,3.6vw,44px);font-weight:800;letter-spacing:-.03em;line-height:1.1;margin:0 0 12px}
.gallery-heading .eyebrow{margin-bottom:12px}
.gallery-members-mark{border-left:0;padding:8px 14px;border:1px solid var(--line);border-radius:var(--pill);background:var(--surface-card)}
.gallery-content-tabs{display:inline-flex;gap:2px;border:1px solid var(--line);border-radius:var(--pill);padding:4px;background:var(--surface-card);margin:6px 0 10px}
.gallery-content-tabs>button{border:0;border-radius:var(--pill);padding:9px 22px;font-weight:700;color:var(--muted)}
.gallery-content-tabs>button[aria-selected=true]{background:var(--text);color:var(--bg);border:0}
.gallery-albums{gap:28px 22px}
.gallery-album{background:var(--surface-card);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow);transition:transform .18s,border-color .18s}
.gallery-album:hover{transform:translateY(-3px);border-color:var(--teal)}
.gallery-album-cover{border:0;border-radius:0;aspect-ratio:4/5}
.gallery-album:hover .gallery-album-cover,.gallery-album:focus-visible .gallery-album-cover{border-color:transparent}
.gallery-album-index{border-radius:var(--pill);background:rgba(255,255,255,.92);color:#17121d;border:0;padding:4px 12px;font-weight:700;letter-spacing:.2px}
.gallery-album-open{border-radius:50%;background:rgba(0,0,0,.5);border:0;color:#fff}
.gallery-album-info{padding:14px 16px 16px}
.gallery-album-info h2{font-size:18px;font-weight:700;margin:6px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gallery-album-info>span{color:var(--teal);font-weight:700}

/* Phân trang */
.pagination button,.pagination a{border-radius:var(--pill)}

/* Admin: thanh bên dạng thẻ, mục là viên thuốc */
.admin-nav{background:var(--surface-card);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px 10px}
.admin-nav-link{border-left:0;border-radius:var(--pill);padding:10px 14px;font-weight:600;color:var(--muted)}
.admin-nav-link .icon{color:inherit}
.admin-nav-link:hover{background:var(--surface2);color:var(--text)}
.admin-nav-link.active{background:var(--text);color:var(--bg)}
.admin-heading h1{font-weight:800;letter-spacing:-.03em}

/* Điện thoại: tab dưới như app, mỗi hàng 1 bài */
@media(max-width:380px){
  .site-header .brand{font-size:15px;gap:5px}
  .site-header .header-actions .language-control select{width:74px;padding-left:8px}
  .site-header .header-actions .button.ghost{padding:8px 6px;font-size:11px}
}
@media(max-width:700px){
  body{padding-bottom:calc(72px + env(safe-area-inset-bottom,0px))}
  .site-header .nav{display:none}
  .admin-nav{display:none}
  .header-inner{flex-wrap:nowrap;gap:10px;padding-top:12px;padding-bottom:12px}
  .header-actions{margin-left:auto}
  .header-actions{gap:6px}
  .header-actions .language-control{margin-left:0}
  .header-actions .language-control select{width:96px;min-height:38px;padding:6px 22px 6px 10px;font-size:12px}
  .gallery-albums{grid-template-columns:1fr;gap:16px}
  .gallery-album-cover{aspect-ratio:4/3}
  .gallery-content-tabs{display:flex;width:100%}.gallery-content-tabs>button{flex:1}
  .mobile-tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:40;justify-content:space-around;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(14px);border-top:1px solid var(--line)}
  .mobile-tab{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 14px;border-radius:10px;font-size:11px;font-weight:600;color:var(--muted)}
  .mobile-tab .icon{width:23px;height:23px}
  .mobile-tab.active{color:var(--accent-hover)}
  .scroll-top{bottom:calc(84px + env(safe-area-inset-bottom,0px))}
}

/* Trang bài đăng: ảnh chính + dải ảnh nhỏ cuộn ngang */
.post-strip{margin:18px 0 8px;max-width:760px}
.post-strip-stage{position:relative;display:block;width:100%;padding:0;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface2);overflow:hidden;cursor:zoom-in;box-shadow:var(--shadow)}
.post-strip-stage img{display:block;width:100%;height:auto;max-height:78vh;object-fit:contain;margin:0 auto}
.post-strip-count,.post-strip-hint{position:absolute;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:var(--pill);background:rgba(0,0,0,.55);color:#fff;font-size:12px;font-weight:700}
.post-strip-count{left:12px;bottom:12px}
.post-strip-hint{right:12px;top:12px}.post-strip-hint .icon{width:14px;height:14px}
.post-strip-rail{position:relative;margin-top:10px}
.post-strip-thumbs{display:flex;gap:8px;overflow-x:auto;scroll-snap-type:x proximity;padding-bottom:8px;scrollbar-width:thin}
.post-strip-thumbs button{flex:none;width:84px;height:84px;padding:0;border:2px solid transparent;border-radius:8px;overflow:hidden;background:var(--surface2);scroll-snap-align:start;opacity:.8;cursor:pointer}
.post-strip-thumbs button.on{border-color:var(--accent);opacity:1}
.post-strip-thumbs img{width:100%;height:100%;object-fit:cover;display:block}
.post-strip-arrow{display:none;position:absolute;top:calc(50% - 4px);transform:translateY(-50%);width:34px;height:34px;border-radius:50%;border:1px solid var(--line);background:var(--surface-card);color:var(--text);font-size:20px;line-height:1;cursor:pointer;box-shadow:var(--shadow);z-index:1}
.post-strip-arrow.left{left:-6px}.post-strip-arrow.right{right:-6px}
@media(hover:hover) and (pointer:fine){.post-strip-arrow{display:grid;place-items:center}}
@media(max-width:700px){.post-strip-thumbs button{width:68px;height:68px}.post-strip{margin-top:12px}}

/* Collection: danh sách bài theo thứ tự (Part N) */
.gallery-part-list{display:flex;flex-direction:column;background:var(--surface-card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:6px 20px}
.gallery-part-row{display:flex;align-items:center;gap:16px;padding:14px 0;border-top:1px solid var(--line);color:inherit;min-width:0}
.gallery-part-row:first-child{border-top:0}
.gallery-part-row:hover strong{color:var(--accent-hover)}
.gallery-part-thumb{flex:none;width:84px;height:84px;border-radius:10px;overflow:hidden;display:grid;place-items:center;background:var(--surface2);color:var(--muted)}
.gallery-part-thumb img{width:100%;height:100%;object-fit:cover}
.gallery-part-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.gallery-part-text small{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.gallery-part-text strong{font-size:17px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gallery-part-text span,.gallery-part-text time{font-size:13px;color:var(--muted)}
.gallery-part-chip{flex:none;padding:3px 12px;border-radius:var(--pill);background:var(--surface2);font-size:12px;font-weight:700;color:var(--muted)}
.gallery-part-row>.icon{flex:none;width:18px;height:18px;color:var(--muted)}
@media(max-width:700px){.gallery-part-thumb{width:64px;height:64px}.gallery-part-row{gap:12px}.gallery-part-list{padding:4px 14px}}

/* Load more */
.load-more{display:flex;flex-direction:column;align-items:center;gap:10px;margin:30px 0 6px}
.load-more small{color:var(--muted);min-height:1.4em}
.load-more .button{min-width:210px;justify-content:center}

/* Bài đăng kiểu Patreon: một cột giữa ~800px, ảnh lớn ở trên, tiêu đề, dòng tác giả + nút, rồi nội dung */
.gallery-post-page{width:min(840px,calc(100% - 48px));max-width:840px}
.gallery-post-page .post-strip{max-width:none;margin:14px 0 0}
.gallery-post-head h1{font-size:clamp(28px,4.2vw,42px);font-weight:800;letter-spacing:-.03em;line-height:1.15;margin:28px 0 18px;overflow-wrap:anywhere}
.gallery-post-author{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.gallery-post-avatar{flex:none;width:46px;height:46px;border-radius:50%;display:grid;place-items:center;background:var(--surface2);border:1px solid var(--line)}
.gallery-post-avatar .brand-icon{width:28px;height:24px}
.gallery-post-byline{display:flex;flex-direction:column;min-width:0;line-height:1.35}
.gallery-post-byline strong{font-size:15px;font-weight:700}
.gallery-post-byline span{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.gallery-post-badge{font-style:normal;font-size:11px;font-weight:800;padding:1px 9px;border-radius:var(--pill);background:var(--surface2);color:var(--text)}
.gallery-post-actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.gallery-post-access{display:flex;align-items:center;gap:8px;margin:18px 0 0;font-size:13px;color:var(--muted)}
.gallery-post-access .icon{width:15px;height:15px}
.gallery-post-teaser,.gallery-post-body,.gallery-rich-body{font-size:17px;line-height:1.75}
.gallery-post-teaser{margin:20px 0 0}
.gallery-post-collections{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
.gallery-post-collections a{padding:4px 14px;border-radius:var(--pill);border:1px solid var(--line);background:var(--surface-card);font-size:13px;font-weight:700}
.gallery-post-collections a:hover{border-color:var(--teal)}
@media(max-width:700px){.gallery-post-page{width:calc(100% - 32px)}.gallery-post-actions{margin-left:0;width:100%}.gallery-post-actions .button{flex:1;justify-content:center}.gallery-post-teaser,.gallery-post-body,.gallery-rich-body{font-size:16px}}

/* Form góp ý: chọn chủ đề, ô nhập rộng, chọn cảm nhận */
.feedback-page{max-width:720px}
.feedback-card{border-radius:var(--radius)}
.feedback-field{display:grid;gap:10px}
.feedback-label{font-weight:700}
.feedback-pills{display:flex;flex-wrap:wrap;gap:8px}
.feedback-pill{padding:8px 16px;border-radius:var(--pill);border:1px solid var(--line);background:var(--surface-card);color:var(--muted);font-weight:700;cursor:pointer}
.feedback-pill:hover:not(:disabled){border-color:var(--teal);color:var(--text)}
.feedback-pill.on{background:var(--text);border-color:var(--text);color:var(--bg)}
.feedback-moods{display:flex;gap:8px}
.feedback-mood{width:54px;height:54px;border-radius:10px;border:1.5px solid var(--line);background:var(--surface-card);font-size:24px;cursor:pointer;line-height:1}
.feedback-mood.on{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,transparent)}
.feedback-card .button.wide{justify-self:stretch;justify-content:center;padding:14px}
.feedback-card textarea{min-height:10rem}
@media(max-width:700px){.feedback-mood{flex:1;width:auto}}

/* Ô chọn nhiều: chip nằm trong ô, danh sách mở dạng dropdown */
.multiselect{position:relative;display:grid;gap:6px;margin-top:8px}
.multiselect-label{font-size:13px;font-weight:700;color:var(--muted)}
.multiselect-field{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-height:46px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-card);cursor:text}
.multiselect-field.open,.multiselect-field:focus-within{border-color:var(--teal);box-shadow:0 0 0 3px color-mix(in srgb,var(--teal) 25%,transparent)}
.multiselect-field.disabled{opacity:.6}
.multiselect-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 4px 3px 12px;border-radius:var(--pill);background:var(--text);color:var(--bg);font-size:13px;font-weight:700}
.multiselect-chip button{display:grid;place-items:center;width:20px;height:20px;border:0;border-radius:50%;background:transparent;color:inherit;padding:0;cursor:pointer;opacity:.8}
.multiselect-chip button:hover{opacity:1;background:color-mix(in srgb,var(--bg) 22%,transparent)}
.multiselect-chip .icon{width:12px;height:12px}
.multiselect-toggle{flex:1;min-width:120px;display:flex;align-items:center;justify-content:space-between;gap:8px;border:0;background:transparent;color:var(--muted);padding:6px 0;min-height:32px;font:inherit;cursor:pointer;text-align:left}
.multiselect-toggle:focus-visible{outline:none}
.multiselect-chevron{font-size:12px;color:var(--muted)}
.multiselect-list{position:absolute;z-index:20;top:calc(100% + 6px);left:0;right:0;margin:0;padding:6px;list-style:none;max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface-card);box-shadow:0 14px 40px rgba(23,18,29,.18)}
.multiselect-option{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;cursor:pointer}
.multiselect-option.active,.multiselect-option:hover{background:var(--surface2)}
.multiselect-option small{margin-left:auto;color:var(--muted)}
.multiselect-box{flex:none;width:18px;height:18px;border:1.5px solid var(--line);border-radius:5px;display:grid;place-items:center;background:var(--surface-card)}
.multiselect-option.on .multiselect-box{background:var(--accent);border-color:var(--accent);color:#fff}
.multiselect-box .icon{width:12px;height:12px;stroke-width:3}
.multiselect-empty{padding:12px;color:var(--muted)}

/* Dashboard admin dạng thư viện: lối tắt */
.admin-shortcuts{display:grid;gap:10px;grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.admin-shortcut{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface-card);font-weight:700;transition:border-color .15s}
.admin-shortcut:hover{border-color:var(--teal)}
.admin-shortcut span{flex:1}
.admin-shortcut .icon{width:18px;height:18px;color:var(--muted)}
.badge{border-radius:var(--pill)}

/* Sắp xếp bài đăng */
.post-sort{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
.post-sort select{width:auto;min-width:150px;margin:0;padding:8px 12px;border-radius:8px;font-weight:600}

.badge.warning{background:color-mix(in srgb,#e0961e 16%,transparent);border-color:color-mix(in srgb,#e0961e 40%,transparent);color:var(--text)}

/* Sắp xếp bài trong collection */
.order-list{list-style:none;margin:14px 0 0;padding:0;display:grid;gap:8px;max-height:56vh;overflow:auto}
.order-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface-card)}
.order-number{flex:none;width:28px;height:28px;border-radius:8px;display:grid;place-items:center;background:var(--surface2);font-weight:700;font-size:12px}
.order-title{flex:1;min-width:0;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.order-buttons{display:flex;gap:6px}
.order-buttons .icon-chip{width:34px;height:34px;font-size:12px}
.order-buttons .icon-chip:disabled{opacity:.35;cursor:default}

/* Menu người dùng ở header (Account / Admin / Sign out) */
.user-menu{position:relative}
.user-menu .avatar{cursor:pointer;border:0;width:38px;height:38px;display:grid;place-items:center;font-weight:700}
.user-menu-panel{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;z-index:50;display:grid;padding:6px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface-card);box-shadow:0 14px 40px rgba(23,18,29,.2)}
.user-menu-email{padding:8px 12px 10px;font-size:12px;color:var(--muted);border-bottom:1px solid var(--line);margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:260px}
.user-menu-panel a,.user-menu-panel button{display:block;text-align:left;width:100%;padding:10px 12px;border:0;border-radius:8px;background:transparent;color:var(--text);font:inherit;font-weight:600;cursor:pointer}
.user-menu-panel a:hover,.user-menu-panel button:hover:not(:disabled){background:var(--surface2)}
.user-menu-error{margin:4px 12px;font-size:12px;color:var(--accent-hover)}
.user-menu-logout{color:var(--accent-hover)!important}
}
