/* hub area styles (owned by the hub builder). Use app.css tokens; keep the restrained house style. */

/* ---------------------------------------------------------- subject tabs */
.hub-tabs { position: relative; display: flex; gap: 2px; margin: 18px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hub-tabs::-webkit-scrollbar { display: none; }
.hub-tabs [role="tab"] { position: relative; flex: none; height: 42px; padding: 0 12px; border: 0; background: none; font-weight: 550; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; border-radius: 8px 8px 0 0; transition: color .16s var(--ease); }
.hub-tabs [role="tab"]:hover { color: var(--ink); }
.hub-tabs [role="tab"][aria-selected="true"] { color: var(--ink); }
.hub-tabs [role="tab"]:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; }
.hub-tab-ink { position: absolute; left: 0; bottom: -1px; width: 100px; height: 2px; background: var(--ink); transform-origin: 0 0; transform: scaleX(0); opacity: 0; pointer-events: none;
  transition: transform .34s var(--ease), opacity .2s var(--ease); }
.hub-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1px solid var(--line); }
.hub-count.new { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.hub-panel.hub-in { animation: hubIn .3s var(--ease); }
@keyframes hubIn { from { opacity: 0; transform: translateY(4px); } }
.hub-panel:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; border-radius: 6px; }
.hub-panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 2px 14px; }
.hub-panel-head h2 { font-size: 16px; }
.hub-panel-head p:empty { display: none; }

/* ------------------------------------------------------------ item cards */
.hub-list { display: flex; flex-direction: column; gap: 12px; }
.hub-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 18px 20px; min-width: 0; scroll-margin-top: calc(var(--topbar) + 16px); }
.hub-item.pinned { border-color: var(--line-2); box-shadow: var(--sh-1); }
.hub-item.is-new { box-shadow: inset 2px 0 0 var(--brand); }
.hub-item-top { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.hub-item-head { min-width: 0; flex: 1; }
.hub-item-head h3 { font-size: 16px; line-height: 1.35; margin-top: 6px; overflow-wrap: anywhere; }
.hub-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.hub-flags:empty { display: none; }
.hub-flags:empty + h3 { margin-top: 0; }
.hub-meta { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.hub-due { flex: none; width: 58px; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 0 7px; background: var(--surface-2); line-height: 1; }
.hub-due .w, .hub-due .m { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.hub-due b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 3px; font-variant-numeric: tabular-nums; }
.hub-due.warn { background: var(--warn-tint); border-color: transparent; }
.hub-due.warn .w, .hub-due.warn .m, .hub-due.warn b { color: var(--warn); }
.hub-due.bad { background: var(--bad-tint); border-color: transparent; }
.hub-due.bad .w, .hub-due.bad .m, .hub-due.bad b { color: var(--bad); }
.hub-body { margin-top: 12px; }
.hub-ann-body { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); white-space: pre-line; }

/* rich text (bodies and the editor) */
.rich { font-size: 14.5px; line-height: 1.62; color: var(--ink); overflow-wrap: anywhere; }
.rich > * + * { margin-top: .6em; }
.rich h3 { font-size: 15px; font-weight: 650; margin-top: 1em; }
.rich h4 { font-size: 14px; font-weight: 650; margin-top: .9em; }
.rich ul, .rich ol { padding-left: 1.3em; }
.rich li + li { margin-top: .25em; }
.rich a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.rich a:hover { text-decoration-color: currentColor; }
.rich blockquote { border-left: 2px solid var(--line-2); padding-left: 12px; color: var(--ink-2); }
.rich code { font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.rich .math-block { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* links and files */
.hub-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 14px; }
.hub-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; text-align: left; min-width: 0; color: var(--ink);
  transition: border-color .16s var(--ease), background .16s var(--ease); }
.hub-link:hover { border-color: var(--ink-3); background: var(--surface-2); }
.hub-link .ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.hub-link .txt { min-width: 0; display: flex; flex-direction: column; }
.hub-link .txt b { font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-link .txt span { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-link .thumb { position: relative; width: 72px; height: 42px; flex: none; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.hub-link .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-link .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(12, 12, 14, .28); }
.hub-files { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hub-files li + li { border-top: 1px solid var(--line); }
.hub-files a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-decoration: none; color: var(--ink); min-width: 0; transition: background .14s; }
.hub-files a:hover { background: var(--surface-2); }
.hub-files .ico { color: var(--ink-3); display: grid; }
.hub-files .nm { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-files .meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.hub-files .dl { color: var(--ink-3); display: grid; }

/* exam help groups */
.hub-groups { gap: 22px; }
.hub-group-h { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 600; margin: 0 2px 10px; }
.hub-group-h .n { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* overview summary card */
.hub-glance .list .li { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; cursor: pointer; padding: 9px 4px; border-radius: 6px; transition: background .14s; }
.hub-glance .list .li:hover { background: var(--surface-2); }
.hub-glance .li .ico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.hub-glance .li > svg { color: var(--ink-3); flex: none; }
.hub-next { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .16s; }
.hub-next:hover { border-color: var(--ink-3); }
.hub-next .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hub-next .txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* subject list: unread marker */
.hub-foot-end { display: inline-flex; align-items: center; gap: 8px; }
.hub-unread { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--brand-tint); color: var(--brand); font-size: 11.5px; font-weight: 600; animation: hubIn .3s var(--ease); }

/* ---------------------------------------------------------- studio */
.hub-studio { margin-top: 30px; }
.hub-studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 0 2px 12px; }
.hub-studio-head h2 { font-size: 16px; }
.hub-studio-head p { max-width: 70ch; margin-top: 3px; }
.hub-centre { width: auto; min-width: 180px; height: 36px; min-height: 36px; padding-top: 0; padding-bottom: 0; }
.hub-seg { margin-bottom: 14px; }
.hub-seg .hub-count { min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
.hub-slist { gap: 10px; }
.hub-sitem { padding: 14px 16px; }
.hub-sitem.pinned { border-color: var(--line-2); }
.hub-sitem-row { display: flex; gap: 12px; align-items: flex-start; }
.hub-move { display: flex; flex-direction: column; gap: 2px; width: 34px; flex: none; }
.hub-move .iconbtn[disabled] { opacity: .3; }
.hub-sitem-main { flex: 1; min-width: 0; }
.hub-sitem-main h3 { font-size: 15px; margin-top: 6px; overflow-wrap: anywhere; }
.hub-excerpt { margin-top: 4px; overflow-wrap: anywhere; }
.hub-sitem-meta { margin-top: 6px; }
.hub-seen { flex: none; width: 150px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .16s; }
.hub-seen:hover:not([disabled]) { border-color: var(--ink-3); }
.hub-seen[disabled] { cursor: default; background: var(--surface-2); }
.hub-seen .bar { height: 5px; }
.hub-sitem-actions { margin: 10px 0 0 46px; }
.hub-del { color: var(--bad); }
.hub-del:hover { background: var(--bad-tint); }

/* editor */
.hub-form fieldset.hub-fieldset { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px 16px; margin: 0; min-width: 0; }
.hub-fieldset legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.hub-fixed { display: flex; align-items: center; gap: 6px; min-height: 38px; }
.hub-pinfield { justify-content: flex-end; padding-bottom: 8px; }
.hub-linkrows { gap: 8px; }
.hub-linkrows:empty { display: none; }
.hub-linkrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.hub-drop { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hub-attlist:empty { display: none; }
.hub-attrow .ico { color: var(--ink-3); display: grid; }
.hub-attrow.failed .main span { color: var(--bad); }
.rt { border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.rt:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 16%, transparent); }
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); }
.rt-btn { min-width: 32px; height: 30px; padding: 0 7px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); display: inline-grid; place-items: center; font-size: 13.5px; transition: background .14s, color .14s; }
.rt-btn:hover { background: var(--surface-2); color: var(--ink); }
.rt-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rt-h { font-weight: 700; } .rt-p { font-weight: 600; } .rt-ol { font-weight: 600; font-size: 12.5px; }
.rt-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rt-linkrow { display: flex; gap: 6px; padding: 6px; border-bottom: 1px solid var(--line); }
.rt-linkrow .input { min-height: 30px; height: 30px; padding: 0 10px; font-size: 13px; }
.rt-area.input { border: 0; border-radius: 0 0 8px 8px; box-shadow: none; min-height: 180px; max-height: 42vh; overflow: auto; padding: 12px 14px; }
.rt-area.input:focus { box-shadow: none; }
.rt-area:empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
.hub-preview .hub-item { box-shadow: none; }

/* book access */
.hub-access { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.hub-access-k { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.hub-access-k > span { display: inline-flex; align-items: center; gap: 5px; }
.hub-access-k .textlink { font-size: 12.5px; min-height: 24px; }
.hub-access-v { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.hub-access-v .chip { white-space: normal; height: auto; min-height: 20px; padding-top: 2px; padding-bottom: 2px; }
.rt-un { font-size: 12px; font-weight: 550; }
.hub-modes { display: grid; gap: 8px; }
.hub-mode { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .16s, background .16s; }
.hub-mode:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.hub-mode input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.hub-mode > span { display: flex; flex-direction: column; gap: 2px; }
.hub-h4 { font-size: 13px; font-weight: 600; margin: 4px 2px 8px; }
.hub-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hub-picked:empty { display: none; }
.hub-pchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 500; animation: hubIn .22s var(--ease); }
.hub-pchip .code { font-size: 11px; color: var(--ink-3); }
.hub-pchip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--ink-3); }
.hub-pchip button:hover { background: var(--surface-3); color: var(--ink); }
.hub-presults { max-height: 240px; overflow: auto; margin-top: 6px; }
.hub-centrechoices { background: var(--surface-2); }

@media (max-width: 680px) {
  .hub-tabs { margin: 14px -16px 14px; padding: 0 8px; }
  .hub-tabs [role="tab"] { padding: 0 10px; }
  .hub-item { padding: 16px; }
  .hub-due { width: 50px; }
  .hub-due b { font-size: 19px; }
  .hub-sitem-row { flex-wrap: wrap; }
  .hub-move { flex-direction: row; width: auto; order: 3; }
  .hub-sitem-main { flex-basis: calc(100% - 0px); }
  .hub-seen { width: 100%; order: 2; }
  .hub-sitem-actions { margin-left: 0; }
  .hub-linkrow { grid-template-columns: minmax(0, 1fr) 34px; }
  .hub-linkrow [name="ltitle"] { grid-column: 1; grid-row: 2; }
  .hub-centre { min-width: 0; width: 100%; }
}
