/* HK Niche Lab v7. Source for style.css: tokens, shared chrome and workspace. */
@font-face{font-family:Manrope;src:url('/static/fonts/Manrope-Variable.ttf') format('truetype');font-weight:200 800;font-style:normal;font-display:swap}
:root{
  --bg:#f6f6f4;--panel:#fff;--field:#fff;--sidebar-bg:#fcfcfb;--surface-soft:#f1f1ee;
  --ink:#202124;--muted:#686a70;--line:#e4e4df;--accent:#8d6224;--accent-2:#d6a64d;
  --accent-soft:#f8efdE;--button-bg:#e8bc72;--button-hover:#edc683;--button-ink:#36260f;
  --good:#26724e;--warn:#8d6224;--bad:#b63d42;--good-bg:#eaf5ee;--warn-bg:#f8efdf;--bad-bg:#fbecef;--mine:#f5f9f5;
  --shadow:0 12px 32px #26251d12;--radius:16px;--side:260px;--ring:#b08336;
  font-family:Manrope,'Segoe UI',sans-serif;font-size:14px;line-height:1.5;color:var(--ink);color-scheme:light;
}
:root[data-theme=dark]{
  --bg:#0c0d10;--panel:#141519;--field:#101114;--sidebar-bg:#111216;--surface-soft:#1c1d22;
  --ink:#f1f1ee;--muted:#a1a2aa;--line:#2a2b31;--accent:#e8bc72;--accent-2:#d7a950;
  --accent-soft:#2b2419;--button-bg:#e8bc72;--button-hover:#f0c987;--button-ink:#30220e;
  --good:#8bccaa;--warn:#e8bc72;--bad:#f19a9d;--good-bg:#172c22;--warn-bg:#2b2419;--bad-bg:#341d24;--mine:#18231c;
  --shadow:0 12px 32px #0005;--ring:#e8bc72;color-scheme:dark;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);min-height:100dvh}
button,input,select,textarea{font:inherit}
button,a,input,select,textarea,summary{touch-action:manipulation}
button,a,summary{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}a{color:var(--accent);text-decoration:none;text-underline-offset:3px}
a:hover{text-decoration:underline}button:disabled{cursor:not-allowed;opacity:.5}
::selection{background:var(--accent-soft);color:var(--ink)}input,textarea{caret-color:var(--accent)}
:focus-visible{outline:2px solid var(--ring);outline-offset:3px}
[hidden]{display:none!important}.ico{width:20px;height:20px;display:block;flex-shrink:0}
.skip-link{position:fixed;left:16px;top:-80px;z-index:80;padding:12px 18px;border-radius:10px;background:var(--button-bg);color:var(--button-ink)}.skip-link:focus{top:12px}

/* Sidebar owns navigation. Only the nav scrolls; brand/platform stay visible. */
.sidebar{position:fixed;inset:0 auto 0 0;width:var(--side);display:flex;flex-direction:column;padding:0 16px;background:var(--sidebar-bg);border-right:1px solid var(--line);z-index:30}
.brand{height:80px;display:flex;align-items:center;gap:8px;flex-shrink:0}
.brand-home{display:flex;align-items:center;gap:10px;flex:1;min-width:0;color:var(--ink)}.brand-home:hover{text-decoration:none}
.logo{width:40px;height:40px;display:block;object-fit:contain;flex-shrink:0}
.brand-text{min-width:0}.brand strong{display:block;font-size:18px;line-height:1.1;font-weight:800;letter-spacing:-.04em}.brand strong span{color:var(--accent)}.brand small{display:block;font-size:10px;color:var(--muted);margin-top:5px;letter-spacing:0;white-space:nowrap}
.sidebar-toggle{width:32px;height:36px;padding:7px;border:0;border-radius:9px;background:transparent;color:var(--muted);flex-shrink:0}.sidebar-toggle:hover{background:var(--surface-soft);color:var(--ink)}.sidebar-toggle .ico{width:18px;height:18px}
.intent{padding:13px 10px 12px;background:var(--surface-soft);border-radius:12px;margin:0 0 20px;flex-shrink:0}
.intent-title{font-size:11px;color:var(--muted);font-weight:600;margin:0 2px 10px}.modes{display:flex;gap:4px}
.mode{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;flex:1;min-width:0;height:56px;padding:6px 3px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-size:11px;font-weight:600}
.mode .ico{width:19px;height:19px}.mode:hover{background:var(--panel);color:var(--ink)}.mode[aria-pressed=true]{background:var(--panel);color:var(--accent)}
#work-hint{font-size:11px;line-height:1.6;margin:11px 2px 0;color:var(--muted);min-height:32px}
#nav{flex:1;overflow:auto;min-height:0;padding:0 0 12px;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
.nav-primary{margin-bottom:18px}#nav a{display:flex;align-items:center;gap:11px;min-height:40px;padding:9px 12px;border-radius:10px;font-size:13px;font-weight:500;color:var(--muted);margin:2px 0}
#nav a .ico{width:19px;height:19px}#nav a span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#nav a:hover{background:var(--surface-soft);color:var(--ink);text-decoration:none}#nav a.active{background:var(--accent-soft);color:var(--accent);font-weight:700}
#nav details{margin-bottom:15px}#nav summary{list-style:none;display:flex;align-items:center;gap:8px;min-height:36px;padding:6px 10px;color:var(--muted);font-size:11px;font-weight:650;cursor:pointer;border-radius:8px}
#nav summary::-webkit-details-marker{display:none}#nav summary>.ico:first-child{width:14px;height:14px}#nav summary>.ico:last-child{width:12px;height:12px;margin-left:auto;transition:transform .18s ease-out}
#nav details[open] summary>.ico:last-child{transform:rotate(180deg)}#nav summary:hover{color:var(--ink)}
.usage{flex-shrink:0;font-size:11px;line-height:1.8;color:var(--muted);border-top:1px solid var(--line);padding:14px 2px 16px;margin:0;background:transparent;overflow-wrap:anywhere}.usage b{font-weight:600;color:var(--ink)}.usage .note{font-size:11px}
.backdrop{display:none}

/* A single, consistent header control scale. */
.shell{margin-left:var(--side);min-height:100dvh}
.topbar{height:72px;position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:24px;padding:0 32px;background:var(--bg);border-bottom:1px solid var(--line)}
.topbar-context{display:flex;flex-direction:column;gap:2px;min-width:120px;max-width:210px;flex-shrink:0}.topbar-context span{color:var(--muted);font-size:11px}.topbar-context strong{font-size:12px;font-weight:650;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.quick{display:flex;gap:10px;align-items:center;background:var(--panel);border:1px solid var(--line);border-radius:10px;height:40px;width:min(390px,35vw);padding:0 10px 0 12px;margin-left:auto;color:var(--muted)}.quick>.ico{width:17px;height:17px}.quick:focus-within{border-color:var(--ring);outline:2px solid var(--accent-soft)}
.quick input[type=search]{flex:1;min-width:0;width:0;background:transparent;border:0;padding:0;border-radius:0;outline:0;font-size:12px;color:var(--ink);height:100%}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}
kbd{font:11px/1.2 Manrope,sans-serif;padding:3px 5px;border:1px solid var(--line);border-radius:4px;color:var(--muted);white-space:nowrap;background:var(--surface-soft)}
.top-right{display:flex;align-items:center;gap:10px;flex-shrink:0}.icon-btn{display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:10px;background:transparent;color:var(--muted);padding:10px}.icon-btn:hover{background:var(--surface-soft);color:var(--ink)}.menu-btn{display:none}
.header-cost{display:flex;align-items:center;gap:9px;height:40px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:var(--panel);font-size:11px;white-space:nowrap;color:var(--muted);font-variant-numeric:tabular-nums}.header-cost .ico{width:18px;height:18px;color:var(--accent)}.header-cost b{color:var(--ink);font-size:13px;font-weight:750}.header-cost:hover{border-color:var(--accent);text-decoration:none}
.header-trial{color:var(--good);background:var(--good-bg);border-radius:6px;padding:3px 6px;font-size:11px}.header-action{background:var(--button-bg);color:var(--button-ink);font-size:11px;font-weight:700;padding:4px 8px;border-radius:6px}
.profile-wrap{position:relative}.profile-btn{display:flex;align-items:center;gap:9px;height:40px;padding:4px 8px 4px 4px;color:var(--ink);background:transparent;border:0;border-radius:10px}.profile-btn:hover,.profile-btn[aria-expanded=true]{background:var(--surface-soft)}.profile-avatar{width:31px;height:31px;border-radius:9px;display:grid;place-items:center;background:var(--surface-soft);border:1px solid var(--line);color:var(--accent);font-weight:750;font-size:11px;flex-shrink:0}.profile-name{font-size:11px;font-weight:650;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.profile-btn>.ico:last-child{width:12px;height:12px;color:var(--muted)}
.profile-panel{position:absolute;right:0;top:calc(100% + 12px);width:270px;border:1px solid var(--line);border-radius:14px;padding:8px;background:var(--panel);box-shadow:var(--shadow);z-index:40}.profile-info{padding:12px 10px;border-bottom:1px solid var(--line)}.profile-info strong{display:block;font-size:13px}.profile-info small{display:block;font-size:11px;color:var(--muted);overflow-wrap:anywhere;margin-top:4px}.profile-language{display:flex;align-items:center;justify-content:space-between;padding:12px 10px;font-size:12px;color:var(--muted)}.profile-panel a,.profile-panel #profile-logout{display:flex;align-items:center;gap:10px;min-height:40px;padding:10px;border:0;border-radius:8px;color:var(--ink);background:transparent;font-size:12px;text-decoration:none;width:100%}.profile-panel a .ico{width:18px;height:18px;color:var(--muted)}.profile-panel a:hover,.profile-panel #profile-logout:hover{background:var(--surface-soft)}.profile-panel #profile-logout{color:var(--bad);margin-top:8px}

/* Shared feature components use exactly the same tokens as the workspace. */
main{padding:32px 36px 60px;max-width:1432px;width:100%;margin:0 auto;min-width:0}main:focus{outline:none}
h1{font-size:27px;line-height:1.25;letter-spacing:-.035em;font-weight:750;margin:0 0 8px;text-wrap:balance}
h2{font-size:16px;font-weight:700;margin:0 0 12px;line-height:1.4;letter-spacing:-.02em}h3{font-size:14px;font-weight:700}
.sub{font-size:13px;color:var(--muted);line-height:1.7;margin:0 0 24px}
.panel{padding:22px 24px;margin-bottom:20px;border-radius:var(--radius);border:1px solid var(--line);background:var(--panel)}
form.search{display:grid;gap:14px}.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
input[type=text],input[type=url],input[type=search],input[type=email],input[type=password],input[type=number],textarea,select{font:inherit;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--field);color:var(--ink);min-height:42px;max-width:100%}
input:focus,textarea:focus,select:focus{border-color:var(--ring);outline:2px solid var(--accent-soft)}input[type=text],input[type=url]{flex:1;min-width:220px}textarea{width:100%;resize:vertical}label.small{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:9px;padding:3px;gap:3px;background:var(--surface-soft);flex-wrap:wrap}.seg button{min-height:32px;padding:5px 12px;border:0;border-radius:6px;background:transparent;color:var(--muted);font:inherit;font-size:12px}.seg button.on{color:var(--ink);background:var(--panel);font-weight:650}.seg.lang button{min-height:28px;padding:4px 8px;font-size:11px}
.chk{display:inline-flex;gap:8px;align-items:center;min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;cursor:pointer;font-size:12px}input[type=checkbox]{accent-color:var(--accent)}
button.primary{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:42px;padding:10px 20px;border:0;border-radius:10px;background:var(--button-bg);color:var(--button-ink);font:inherit;font-size:13px;font-weight:750;transition:background-color .18s ease-out}
button.primary:hover{background:var(--button-hover)}button.primary:active{background:var(--accent-2)}button.primary .ico{width:18px;height:18px}button.ghost{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:38px;padding:8px 14px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);font:inherit;font-size:12px}button.ghost:hover{border-color:var(--accent);background:var(--surface-soft)}
.tabs{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:18px}.tabs button{min-height:36px;padding:7px 14px;border:1px solid var(--line);border-radius:9px;color:var(--muted);background:var(--panel);font-size:12px}.tabs button.on{color:var(--accent);background:var(--accent-soft);border-color:var(--accent)}

/* Workspace: one research task, one ordered workflow, then real activity. */
.workspace-heading{display:flex;justify-content:space-between;gap:20px;align-items:center;margin:0 0 28px}.workspace-heading h1{font-size:28px;margin:0 0 8px}.workspace-heading p{font-size:12px;color:var(--muted);margin:0;line-height:1.7}.text-link{display:inline-flex;align-items:center;gap:7px;font-size:11px;color:var(--muted);white-space:nowrap}.text-link .ico{width:16px;height:16px}.text-link:hover{color:var(--accent);text-decoration:none}
.home-launch{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);gap:20px;align-items:stretch}
.research-surface,.workflow-surface,.activity-surface{background:var(--panel);border:1px solid var(--line);border-radius:16px;min-width:0}
.research-surface{padding:26px 30px;display:flex;flex-direction:column}.research-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.research-mark{color:var(--accent)}.research-mark .ico{width:25px;height:25px}.platform-note{font-size:11px;padding:5px 9px;border:1px solid var(--line);border-radius:6px;color:var(--muted)}
.research-surface h2{font-size:30px;line-height:1.25;letter-spacing:-.04em;margin-bottom:14px;font-weight:750}.research-description{color:var(--muted);font-size:13px;line-height:1.8;max-width:50ch;margin:0 0 24px}
.premium-search label{display:block;font-size:11px;font-weight:650;margin-bottom:9px}.research-input-row{display:flex;gap:9px}.search-field{display:flex;align-items:center;gap:10px;flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;background:var(--field);height:46px;padding:0 12px;color:var(--muted)}.search-field .ico{width:18px;height:18px}.search-field:focus-within{outline:2px solid var(--accent-soft);border-color:var(--ring)}.search-field input[type=search]{width:100%;min-width:0;height:100%;border:0;background:transparent;border-radius:0;outline:none;padding:0;font-size:12px}.research-input-row button.primary{height:46px;min-height:46px;padding:10px 16px;white-space:nowrap;font-size:12px}
.premium-chips{margin:17px 0 22px}.premium-chips>span{display:block;color:var(--muted);font-size:11px;margin-bottom:10px}.premium-chips>div{display:flex;gap:6px;flex-wrap:wrap}.premium-chips button{padding:6px 9px;min-height:32px;font-size:11px;font-weight:500;background:var(--surface-soft);border:0;border-radius:7px;color:var(--muted)}.premium-chips button:hover{background:var(--accent-soft);color:var(--accent)}
.research-footnote{display:flex;align-items:center;gap:7px;margin-top:auto;padding-top:12px;font-size:11px;color:var(--muted)}.research-footnote .ico{width:15px;height:15px;color:var(--good)}
.workflow-surface{padding:23px 22px;display:flex;flex-direction:column}.section-top{display:flex;justify-content:space-between;align-items:center;gap:12px}.section-top h2{margin:0;font-size:14px}.workflow-description{margin:7px 0 14px;font-size:11px;color:var(--muted)}
.workflow-list{padding:0;margin:0 0 16px;list-style:none;flex:1}.workflow-list a{display:flex;align-items:center;gap:12px;border-radius:9px;padding:10px 5px;color:var(--ink)}.workflow-list a:hover{background:var(--surface-soft);text-decoration:none}.workflow-number{width:24px;display:grid;place-items:center;font-size:11px;color:var(--muted);flex-shrink:0}.workflow-list li:first-child .workflow-number{color:var(--accent);background:var(--accent-soft);border-radius:7px;height:25px}.workflow-copy{flex:1;min-width:0}.workflow-copy strong{display:block;font-size:12px;font-weight:650}.workflow-copy small{display:block;font-size:11px;color:var(--muted);margin-top:3px}.workflow-list .ico{width:13px;height:13px;color:var(--muted)}
.workflow-start{min-height:38px;display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--line);border-radius:9px;background:var(--surface-soft);color:var(--accent);font-size:11px;font-weight:650}.workflow-start .ico{width:17px;height:17px}.workflow-start:hover{border-color:var(--accent);text-decoration:none;background:var(--accent-soft)}
.overview-stats{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));padding:21px 0;margin:4px 0 22px;border-bottom:1px solid var(--line);gap:20px}.overview-stats>div{padding:0 10px 0 0}.overview-stats span{display:block;font-size:11px;color:var(--muted);margin-bottom:5px}.overview-stats strong{font-size:23px;line-height:1.4;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
.home-activity{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:20px}.activity-surface{padding:21px 22px}.recent-list,.signal-list{list-style:none;padding:0;margin:17px 0 0}.recent-list li+li,.signal-list li+li{border-top:1px solid var(--line)}.recent-list a{display:flex;align-items:center;gap:12px;color:var(--ink);padding:13px 0;text-decoration:none}.recent-list a:hover strong,.signal-list a:hover strong{color:var(--accent)}.activity-icon{display:grid;place-items:center;width:34px;height:34px;flex-shrink:0;border-radius:9px;color:var(--muted);background:var(--surface-soft)}.activity-icon .ico{width:18px;height:18px}.activity-copy{flex:1;min-width:0}.activity-copy strong{display:block;font-size:11px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activity-copy small,.signal-list small{display:flex;gap:12px;font-size:11px;color:var(--muted);margin-top:5px}.activity-copy small span{margin-left:auto;white-space:nowrap}.recent-list a>.ico{width:13px;height:13px;color:var(--muted)}
.signal-list a{display:block;color:var(--ink);padding:12px 0;text-decoration:none}.signal-top{display:flex;gap:8px;align-items:center;justify-content:space-between;margin-bottom:8px}.signal-top>.note{font-size:11px;white-space:nowrap}.signal-badge{display:inline-flex;gap:7px;align-items:center;font-size:11px;font-weight:600;padding:3px 7px;border-radius:5px;color:var(--warn);background:var(--warn-bg)}.signal-badge.bad{color:var(--bad);background:var(--bad-bg)}.signal-list strong{font-size:11px;line-height:1.7;font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.signal-list small span{margin-left:auto;white-space:nowrap}.activity-empty{text-align:center;padding:32px 8px;color:var(--muted);font-size:12px}.activity-empty>.ico{margin:0 auto 10px;width:25px;height:25px}.activity-empty p{max-width:35ch;margin:0 auto 10px}
#home-body>.loading{height:130px;text-align:center;padding-top:48px;color:var(--muted)}

.auth-mode .profile-wrap,.auth-mode .topbar-context{display:none}

#view .ico{display:inline-block;vertical-align:middle}#nav{overscroll-behavior:contain}h1,h2,h3{scroll-margin-top:90px} .quick input{scroll-margin-top:90px}


/* Existing feature components, mapped to v7 tokens. */
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g-score { grid-template-columns: 300px 1fr; }
.g-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.g-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.g-2 { grid-template-columns: 1fr 1fr; }

.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;  }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Thẻ tác vụ nhanh trên Tổng quan */
.g-actions { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
a.action { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; color: var(--ink);  transition: transform .12s, border-color .12s; }
a.action:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
a.action .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
a.action b { display: block; margin-bottom: 2px; }
a.action small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.hero { background: var(--button-bg); color: #fff; border: 0; }
.hero .sub, .hero .note { color: rgba(255, 255, 255, .85); }
:root[data-theme="dark"] .hero { color: var(--button-ink); }
:root[data-theme="dark"] .hero .sub { color: var(--button-ink); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.ring { --p: 0; --c: var(--accent); width: 150px; height: 150px; border-radius: 50%; margin: 6px auto 10px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 38px; line-height: 1; }
.ring small { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { background: var(--bg); color: var(--muted); }
.bar { margin: 10px 0; font-size: 13px; }
.bar .lbl { display: flex; justify-content: space-between; }
.bar .track { height: 7px; background: var(--line); border-radius: 99px; margin-top: 4px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; background: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px;  }
.card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card .name { font-weight: 700; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .best { font-size: 13px; }
.card .nums { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.card .nums b { display: block; color: var(--ink); font-size: 14px; }
.badge-x { background: var(--bad-bg); color: var(--bad); border-radius: 999px; padding: 2px 9px; font-weight: 700; font-size: 12px; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 8px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover td { background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.mine td { background: var(--mine); }
.table-wrap { overflow-x: auto; }
.x-hot { color: var(--bad); font-weight: 700; }
.x-up { color: var(--warn); font-weight: 700; }

.chart { width: 100%; height: 340px; }
.chart.sm { height: 260px; }
.chips span { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin: 0 6px 6px 0; font-size: 12px; }
.note { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.loading { color: var(--muted); padding: 30px 0; text-align: center; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 12px 14px; }

.rules { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.rules li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; }
.rules .fix { color: var(--warn); grid-column: 2 / 4; }
details summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.preview { display: flex; gap: 10px; align-items: flex-start; background: var(--bg); border-radius: 10px; padding: 10px; }
.preview img { width: 120px; border-radius: 8px; }
.preview .t { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; z-index: 50; }
.check li { list-style: none; margin: 8px 0; }
.grade { font-size: 64px; font-weight: 800; line-height: 1; }

/* ---------- Khuôn v0.12: mã tính năng, Sắp có, Cách dùng chuẩn, lộ trình ---------- */
nav a .nav-code { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
nav a.active .nav-code { color: var(--accent); }
nav a .nav-soon { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.howto { padding: 12px 18px; }
.howto summary { font-weight: 600; padding: 2px 0; }
.howto[open] summary { margin-bottom: 8px; }
.howto p { margin: 6px 0 10px; font-size: 13.5px; }
.howto ol.steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.howto ul { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.howto .good b { color: var(--good); font-size: 12.5px; }
.howto .bad b { color: var(--bad); font-size: 12.5px; }
a.ghost-link { display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 5px 11px; font-size: 13px; color: var(--ink); background: var(--panel); }
a.ghost-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cost-est { margin: 0; font-size: 13px; color: var(--ink); background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.road { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.road-step { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; color: var(--ink); background: var(--panel); }
.road-step:hover { border-color: var(--accent); text-decoration: none; }
.road-step b { display: block; font-size: 13px; margin-top: 2px; }
.road-step.is-new { border-style: dashed; }
.road-arrow { align-self: center; color: var(--muted); font-size: 18px; }
.soon { border-style: dashed; }

/* ---------- v0.14: Mổ băng / Chủ đề thắng ---------- */
ul.tight, ol.tight { margin: 4px 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.quote { font-size: 12px; color: var(--muted); font-style: italic; border-left: 2px solid var(--line); padding-left: 8px; margin: 2px 0; }

/* ---------- v0.15: Kênh của tôi / Lịch đăng ---------- */
.card .ypp .bar { margin: 4px 0; font-size: 12px; }
.hours { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-top: 10px; }
.hours button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 8px; padding: 6px 0; font: inherit; font-size: 12px; cursor: pointer; }
.hours button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.hours button.gold { box-shadow: inset 0 -3px 0 var(--warn); }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.kanban .col { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.kanban .col-h { font-weight: 600; font-size: 13px; margin: 2px 4px 8px; }
.cal-item { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;  }
.cal-item .t { font-weight: 600; font-size: 13px; }
.cal-item .row { margin-top: 6px; gap: 6px; }
.cal-item button.ghost { padding: 4px 8px; font-size: 12px; }
.cal-item.overdue { border-color: var(--bad); }
tr.overdue td { background: var(--bad-bg); }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hours { grid-template-columns: repeat(8, 1fr); } }

/* ---------- v0.17: đăng nhập (chế độ công khai) ---------- */
body.auth-mode .sidebar, body.auth-mode .topbar .quick, body.auth-mode #cost-chip { display: none; }
body.auth-mode .shell { margin-left: 0; }
.auth-wrap { display: grid; place-items: center; min-height: 70vh; }
.auth { width: 100%; max-width: 420px; padding: 28px; }
.auth form { display: grid; gap: 10px; }
.auth input { width: 100%; }

/* In / lưu PDF: chỉ in nội dung trang */
@media print {
  .sidebar, .topbar, .backdrop, .toast, .howto, form.search, button, a.ghost-link { display: none !important; }
  .shell { margin-left: 0; }
  main { padding: 0; max-width: none; }
  .panel, .card, .tile { box-shadow: none; break-inside: avoid; }
  :root { --bg: #fff; }
}


/* Structural responsive rules; the shared tokens do not change arbitrarily. */
@media(min-width:901px){
  body.sidebar-collapsed{--side:76px}body.sidebar-collapsed .sidebar{padding:0 10px}body.sidebar-collapsed .brand{height:104px;flex-direction:column;justify-content:center;gap:4px}body.sidebar-collapsed .brand-home{flex:none}body.sidebar-collapsed .brand-text{display:none}body.sidebar-collapsed .intent{padding:5px;background:transparent;margin-bottom:12px}body.sidebar-collapsed .intent-title,body.sidebar-collapsed #work-hint{display:none}body.sidebar-collapsed .modes{flex-direction:column}body.sidebar-collapsed .mode{flex:none;height:38px}body.sidebar-collapsed .mode span{display:none}body.sidebar-collapsed #nav a{padding:10px;justify-content:center}body.sidebar-collapsed #nav a span{display:none}body.sidebar-collapsed #nav summary{padding:10px;justify-content:center}body.sidebar-collapsed #nav summary span,body.sidebar-collapsed #nav summary>.ico:last-child{display:none}body.sidebar-collapsed #nav summary>.ico:first-child{width:17px;height:17px}body.sidebar-collapsed .usage{display:none}
}
@media(max-width:1250px){.topbar{gap:16px;padding:0 24px}.quick{width:270px}.profile-name{display:none}main{padding:28px 24px 48px}.research-surface{padding:24px}.research-surface h2{font-size:27px}.home-launch{grid-template-columns:minmax(0,1.45fr) minmax(285px,1fr)}}
@media(max-width:1100px){.topbar-context{display:none}.quick{margin-left:0;flex:1;width:auto;max-width:390px}.top-right{margin-left:auto}.home-launch{gap:16px;grid-template-columns:minmax(0,1.3fr) minmax(280px,1fr)}.research-input-row{flex-wrap:wrap}.research-input-row .search-field{flex-basis:100%}.home-activity{grid-template-columns:1fr}.workspace-heading .text-link{display:none}}
@media(max-width:900px){.sidebar{transform:translateX(-100%);transition:transform .2s ease-out;width:260px}.shell{margin-left:0}.sidebar-toggle{display:none}body.nav-open .sidebar{transform:none}body.nav-open .backdrop{display:block;position:fixed;inset:0;background:#0007;z-index:25}.menu-btn{display:grid}.topbar{height:64px;padding:0 16px;gap:10px}.top-right{gap:5px}.quick{max-width:360px}.quick kbd{display:none}.home-launch{grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr)}.home-activity{grid-template-columns:1fr 1fr}.profile-panel{position:fixed;right:12px;top:64px;width:min(270px,calc(100vw - 24px))}main{padding:24px 20px 48px}.g-score,.g-2{grid-template-columns:1fr}}
@media(max-width:700px){.home-launch,.home-activity{grid-template-columns:1fr}.research-surface{padding:24px}.research-surface h2{font-size:28px}.research-input-row{flex-wrap:nowrap}.research-input-row .search-field{flex-basis:auto}.workflow-surface{padding:22px 24px}.overview-stats{grid-template-columns:repeat(3,1fr);gap:20px;padding:22px 0}.overview-stats strong{font-size:22px}.workspace-heading{margin-bottom:22px}.workspace-heading h1{font-size:24px}.header-cost-label{display:none}.header-cost{padding:0 9px;gap:7px}.profile-btn{padding:3px}.profile-btn>.ico:last-child{display:none}.header-trial{display:none}}
@media(max-width:480px){.topbar{padding:0 10px;gap:6px}.quick{min-width:0;max-width:none;padding:0 9px;gap:6px}.quick>.ico{width:16px;height:16px}.quick input[type=search]{font-size:16px}.top-right{gap:1px}.icon-btn{width:36px;height:40px;padding:8px}.header-cost{gap:5px;padding:0 7px}.header-cost .ico{width:15px;height:15px}.header-cost b{font-size:11px}.header-action{display:none}.profile-avatar{width:29px;height:29px;font-size:11px}.profile-btn{height:40px}.brand-home{gap:10px}main{padding:24px 16px 40px}.workspace-heading h1{font-size:23px}.workspace-heading p{font-size:12px;max-width:38ch}.research-surface,.workflow-surface{padding:22px}.research-surface h2{font-size:27px}.research-input-row{flex-wrap:wrap}.research-input-row .search-field{flex-basis:100%}.search-field input[type=search]{font-size:16px}.research-input-row button.primary{width:100%}.activity-surface{padding:20px}.signal-top{flex-wrap:wrap}.recent-list a{gap:9px}.activity-copy small{gap:5px}.activity-copy small span{font-size:11px}.overview-stats span{font-size:11px}.profile-language .seg{flex-wrap:nowrap}input[type=text],input[type=url]{min-width:0;width:100%}.row>input,.row>select{max-width:100%}.g-cards{grid-template-columns:1fr}.g-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
