/* HubPost: giao diện tối theo DESIGN.md (x.ai) + design/FACTORY-UI.md. Weight 400 cho mọi thứ. */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-vietnamese-400-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-vietnamese-500-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Geist Mono'; font-weight: 400; font-display: swap; src: url(fonts/geist-mono-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-weight: 400; font-display: swap; src: url(fonts/geist-mono-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-weight: 400; font-display: swap; src: url(fonts/geist-mono-vietnamese-400-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }

:root {
  --canvas: #0a0a0a; --card: #191919; --nest: #363a3f; --soft: #1a1c20; --line: #212327;
  --ink: #ffffff; --body: #dadbdf; --mute: #7d8187;
  --ok: #6ee7b7; --warn: #ff7a17; --err: #ff6b6b; --info: #a0c3ec; --violet: #c4b5fd; --sand: #ffc285;
  --font: Inter, system-ui, -apple-system, sans-serif; --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px; --pill: 9999px; --side: 248px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--canvas); color: var(--body); font: 400 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, strong, b, th { font-weight: 400; }
h1 { color: var(--ink); font-size: 32px; line-height: 38px; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { color: var(--ink); font-size: 20px; line-height: 28px; margin: 0 0 12px; }
h3 { color: var(--ink); font-size: 16px; line-height: 24px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
.mute { color: var(--mute); } .ink { color: var(--ink); } .ok { color: var(--ok); } .warn { color: var(--warn); } .err { color: var(--err); } .info { color: var(--info); }
.mono, .eyebrow { font-family: var(--mono); }
.eyebrow { font-size: 12px; line-height: 16px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--mute); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: 0 0 0 1px #fff, 0 0 0 3px rgba(255,255,255,.35); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Icon: PNG làm mask, màu theo chữ */
.icon { display: inline-block; width: 20px; height: 20px; flex: none; background-color: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -4px; }
.icon.s16 { width: 16px; height: 16px; vertical-align: -3px; } .icon.s24 { width: 24px; height: 24px; }

/* Nút: viên thuốc chỉ cho hành động */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 18px; border-radius: var(--pill); border: 1px solid rgba(255,255,255,.25); background: transparent; color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.45); }
.btn.primary { background: #fff; color: #0a0a0a; border-color: #fff; } .btn.primary:hover { background: #fafaf7; }
.btn.danger { color: var(--err); border-color: var(--err); } .btn.danger:hover { background: rgba(255,107,107,.1); }
.btn.sm { min-height: 28px; padding: 0 12px; font-size: 13px; } .btn.icon-only { padding: 0; width: 36px; } .btn.sm.icon-only { width: 28px; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border-radius: var(--pill); border: 1px solid var(--line); background: transparent; color: var(--body); font: inherit; font-size: 13px; cursor: pointer; }
.chip[aria-pressed=true] { background: #fff; color: #0a0a0a; border-color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--pill); border: 1px solid currentColor; font-size: 12px; line-height: 18px; white-space: nowrap; }
.tag.ok { background: rgba(110,231,183,.1); } .tag.warn { background: rgba(255,122,23,.1); } .tag.err { background: rgba(255,107,107,.1); } .tag.info { background: rgba(160,195,236,.1); } .tag.mute { color: var(--mute); }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.35); cursor: pointer; }

/* Ô nhập, bảng, thẻ: chữ nhật bo 8px */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; color: var(--body); }
.hint { font-size: 13px; color: var(--mute); } .error-text { font-size: 13px; color: var(--err); }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--canvas); color: var(--ink); font: inherit; }
textarea { resize: vertical; min-height: 96px; line-height: 20px; }
input::placeholder, textarea::placeholder { color: var(--mute); }
input:hover, select:hover, textarea:hover { border-color: #363a3f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] { border-color: var(--err); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: #fff; padding: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; } .check input { margin-top: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; } .card.nest { background: var(--nest); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; } .grid > .card { margin-bottom: 0; } .grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .row.between { justify-content: space-between; } .stack > * + * { margin-top: 12px; } .grow { flex: 1; min-width: 0; }
.stat { padding: 20px; } .stat .v { font-size: 32px; line-height: 38px; color: var(--ink); font-family: var(--mono); font-weight: 500; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--mute); background: transparent; }
tbody tr:hover { background: var(--soft); } tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--mute); font: inherit; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: #fff; }

/* Khung app */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--canvas); }
.brand { font-size: 20px; color: var(--ink); padding: 4px 12px 16px; letter-spacing: -.01em; text-decoration: none; display: block; }
.nav-group { margin-top: 16px; padding: 0 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius); color: var(--body); text-decoration: none; }
.nav a:hover { background: var(--soft); color: var(--ink); } .nav a[aria-current=page] { background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 7px 11px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 32px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10,10,10,.92); backdrop-filter: blur(8px); z-index: 20; }
.content { padding: 32px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.menu-btn { display: none; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 280px; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); z-index: 40; max-height: 70vh; overflow: auto; }
.pop-item { display: block; width: 100%; text-align: left; padding: 10px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--body); font: inherit; cursor: pointer; text-decoration: none; }
.pop-item:hover { background: var(--soft); } .pop-item:last-child { border-bottom: 0; }
.rel { position: relative; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--pill); background: var(--err); color: #0a0a0a; font: 11px/16px var(--mono); text-align: center; }

/* Hộp thoại, toast */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 760px; } .modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--ok); border-radius: var(--radius); padding: 12px 16px; max-width: 360px; color: var(--ink); }
.toast.err { border-left-color: var(--err); }
.empty { text-align: center; padding: 56px 24px; color: var(--mute); } .empty h3 { color: var(--ink); }
.skeleton { background: linear-gradient(90deg, var(--card), var(--soft), var(--card)); background-size: 200% 100%; animation: sk 1.4s linear infinite; border-radius: var(--radius); min-height: 20px; } @keyframes sk { to { background-position: -200% 0; } }
.alert { border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; background: var(--card); }
.alert.warn { border-left-color: var(--warn); } .alert.err { border-left-color: var(--err); } .alert.ok { border-left-color: var(--ok); }
.kbd-code { font-family: var(--mono); background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; word-break: break-all; display: block; }
.phone { width: 180px; aspect-ratio: 9 / 16; background: var(--nest); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; color: var(--mute); }
.phone video, .phone img { width: 100%; height: 100%; object-fit: cover; }
.dropzone { border: 1px dashed rgba(255,255,255,.25); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--mute); cursor: pointer; } .dropzone.over { border-color: #fff; background: var(--soft); }
.progress { height: 4px; background: var(--line); border-radius: var(--pill); overflow: hidden; } .progress > i { display: block; height: 100%; background: #fff; }

/* Lịch */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .dow { padding: 8px 12px; border-bottom: 1px solid var(--line); font: 12px/16px var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--mute); }
.cal .day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; } .cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: rgba(255,255,255,.015); color: var(--mute); } .cal .day.today .dnum { color: #0a0a0a; background: #fff; border-radius: 4px; padding: 0 6px; } .cal .day.drop { background: var(--soft); outline: 1px solid #fff; outline-offset: -1px; }
.cal .item { display: block; width: 100%; text-align: left; margin-top: 4px; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--line); background: var(--card); color: var(--body); font: 12px/16px var(--font); cursor: grab; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .item.posted { border-color: rgba(110,231,183,.5); } .cal .item.failed { border-color: rgba(255,107,107,.6); }
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; } .week > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 44px; padding: 2px 4px; position: relative; } .week .h { font: 12px var(--mono); color: var(--mute); text-align: right; }

/* Trang công khai và trang giữa màn hình */
.pub { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.pub-nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.hero { padding: 96px 0 72px; } .hero h1 { font-size: 64px; line-height: 74px; letter-spacing: -.03em; max-width: 880px; margin-bottom: 20px; } .hero p { font-size: 18px; line-height: 28px; max-width: 620px; color: var(--body); }
.price-card { display: flex; flex-direction: column; gap: 8px; } .price-card .p { font-size: 32px; line-height: 38px; color: var(--ink); } 
.center, .plain .center { max-width: 440px; margin: 10vh auto; padding: 0 24px; } body.plain { background: var(--canvas); }
.center.wide { max-width: 560px; }
.footer { border-top: 1px solid var(--line); margin-top: 96px; padding: 32px 0; color: var(--mute); }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .18s; }
  .side.open { transform: none; } .menu-btn { display: inline-flex; }
  .top { padding: 12px 16px; } .content { padding: 20px 16px; }
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 40px; line-height: 48px; } .hero { padding: 48px 0; }
}
@media (max-width: 560px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 26px; line-height: 32px; } .cal .day { min-height: 72px; } th, td { padding: 10px 12px; } }
.icon.flip { transform: scaleY(-1); }

@media (max-width: 560px) { .top .btn.sm:not(.icon-only):not(.menu-btn) { padding: 0 10px; } .top select { min-width: 0 !important; max-width: 150px; } .content { padding: 16px 12px; } .page-head { gap: 12px; } .card { padding: 16px; } .stat .v { font-size: 26px; } }

.grid.compose { grid-template-columns: minmax(0, 1fr) 220px; align-items: start; } .compose-preview { position: sticky; top: 80px; }
@media (max-width: 560px) { .grid.compose { grid-template-columns: minmax(0, 1fr); } .compose-preview { position: static; order: -1; } .compose-preview .phone { width: 120px; } }
.icon.blank { background: none; -webkit-mask: none; mask: none; }
td.cap { text-transform: capitalize; } td.nowrap { white-space: nowrap; }
