/* Mihenk, direction 12: the ONE terminal frame (CERCEVE.md, BRIF3 §5).
   Reference markup: /home/claude/tasarim/alti/cerceve/d12-frame.html (admin) and d12-frame-member.html (member, KOL list only).
   Link order on every terminal screen: d12.css, then d12-frame.css, then the screen's group stylesheet.
   Every class here starts with tf- so no group stylesheet can restyle the frame by accident (they style .abar, .anav, .pin, .seg ...).
   Only d12.css tokens are used, so day (.d12) and night (.d12.d12-night) need no extra colour rules.
   Three tiers, 151px tall at 1440: utility strip 40 + 1, main bar 64 + 1, pages bar 44 + 1.
   No animation; the only movement is the member Upgrade press feedback, off under reduced motion. */

.d12 .tf { position: relative; z-index: 6; background: var(--bg); color: var(--tx); font-size: 14px; line-height: 20px; }
.d12 .tf-in { max-width: 1440px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; gap: 16px; }
.d12 .tf .i { width: 16px; height: 16px; }

/* ---------- tier 1: utility strip (View as for admin, tools, help, theme, feedback, log out) ---------- */
.d12 .tf-util { background: var(--panel); border-bottom: 1px solid var(--line-soft); }
.d12 .tf-util .tf-in { height: 40px; }
.d12 .tf-va { display: flex; align-items: center; gap: 8px; flex: none; }
.d12 .tf-lab { font-size: 13px; line-height: 16px; font-weight: 700; color: var(--tx2); white-space: nowrap; }
.d12 .tf-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--raised); }
.d12 .tf-seg button { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid transparent; font-size: 13px; line-height: 16px; font-weight: 600; color: var(--tx2); white-space: nowrap; }
.d12 .tf-seg button[aria-pressed="true"] { background: var(--seg-on); border-color: var(--seg-line); color: var(--tx); font-weight: 700; }
.d12 .tf-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.d12 .tf-tools a, .d12 .tf-tools button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 13px; line-height: 16px; font-weight: 600; color: var(--tx2); white-space: nowrap; }
.d12 .tf-tools .tf-ic { width: 32px; padding: 0; justify-content: center; }
.d12 .tf-tools [aria-current="page"], .d12 .tf-tools [aria-expanded="true"] { background: var(--bg); color: var(--tx); font-weight: 700; box-shadow: inset 0 0 0 1px var(--seg-line); }
.d12 .tf-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); flex: none; }
/* member only: Upgrade, a compact split button (label block + chevron block, 3px apart) in the slot where admins have View as */
.d12 .tf-up { display: inline-flex; align-items: stretch; gap: 3px; height: 28px; flex: none; transition: transform 160ms var(--ease); }
.d12 .tf-up > span { display: flex; align-items: center; border-radius: 6px; background: var(--pri); color: var(--on-pri); font-size: 13px; line-height: 16px; font-weight: 700; }
.d12 .tf-up .tf-up-l { padding: 0 10px; }
.d12 .tf-up .tf-up-i { width: 28px; justify-content: center; }
.d12 .tf-up:active { transform: scale(0.97); }

/* small plain tags: Admin (admin-only destinations), Soon */
.d12 .tf-adm, .d12 .tf-soon { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 12px; line-height: 16px; font-weight: 800; letter-spacing: 0; white-space: nowrap; flex: none; }
.d12 .tf-adm { background: var(--tag-a); color: var(--tag-a-tx); }
.d12 .tf-soon { background: var(--tag-s); color: var(--tag-s-tx); }

/* ---------- tier 2: main bar (logo, sections, search, clock, language, plan, account) ---------- */
.d12 .tf-bar { border-bottom: 1px solid var(--line-soft); }
.d12 .tf-bar .tf-in { height: 64px; }
.d12 .tf-logo { display: block; flex: none; border-radius: 6px; }
.d12 .tf-logo img { height: 30px; width: auto; }
.d12 .tf-sec { display: flex; gap: 2px; }
.d12 .tf-sec a { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border-radius: 8px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--tx2); white-space: nowrap; }
.d12 .tf-sec a .i { width: 14px; height: 14px; }
.d12 .tf-sec a[aria-current="page"] { background: var(--raised); color: var(--tx); font-weight: 700; box-shadow: inset 0 -2px 0 var(--pri-tx); }
.d12 .tf-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.d12 .tf-q { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-strong); color: var(--tx3); }
.d12 .tf-q input { width: 128px; height: 34px; padding: 0; border: 0; outline: 0; background: transparent; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--tx); }
.d12 .tf-q input::placeholder { color: var(--tx3); opacity: 1; }
.d12 .tf-q:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.d12 .tf-clk { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--tag-t); color: var(--tag-t-tx); font-weight: 700; white-space: nowrap; }
.d12 .tf-clk .num { color: var(--tx); }
.d12 .tf-sel { position: relative; display: inline-flex; align-items: center; }
.d12 .tf-sel select { appearance: none; -webkit-appearance: none; height: 36px; padding: 0 30px 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--tx); cursor: pointer; }
.d12 .tf-sel .i { position: absolute; right: 10px; width: 14px; height: 14px; pointer-events: none; color: var(--tx2); }
.d12 .tf-sel select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.d12 .tf-plan { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--tag-a); color: var(--tag-a-tx); font-weight: 800; white-space: nowrap; }
.d12 .tf-plan.trial { background: var(--tag-s); color: var(--tag-s-tx); }
.d12 .tf-acct { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--dark); color: var(--on-dark); flex: none; }
.d12 .tf-acct .i { width: 18px; height: 18px; }

/* ---------- tier 3: pages bar (second level of the current section; underline tabs) ---------- */
.d12 .tf-pg { border-bottom: 1px solid var(--line); }
.d12 .tf-pg .tf-in { height: 44px; align-items: stretch; }
.d12 .tf-pages { display: flex; align-items: stretch; gap: 4px; }
.d12 .tf-pages[hidden] { display: none; }
.d12 .tf-pages a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--tx2); white-space: nowrap; }
.d12 .tf-pages a[aria-current="page"] { color: var(--tx); font-weight: 700; box-shadow: inset 0 -2px 0 var(--pri-tx); }
.d12 .tf-pages a:focus-visible { outline-offset: -2px; border-radius: 6px; }
.d12 .tf-pages .tf-lab { display: inline-flex; align-items: center; padding-right: 4px; }

@media (hover: hover) and (pointer: fine) {
  .d12 .tf-sec a:hover { color: var(--tx); background: var(--raised); }
  .d12 .tf-tools a:hover, .d12 .tf-tools button:hover { color: var(--tx); background: var(--raised); }
  .d12 .tf-seg button:hover { color: var(--tx); }
  .d12 .tf-pages a:hover { color: var(--tx); }
  .d12 .tf-pages a:not([aria-current="page"]):hover { box-shadow: inset 0 -2px 0 var(--line-strong); }
  .d12 .tf-q:hover, .d12 .tf-sel select:hover { border-color: var(--tx2); }
}

@media (prefers-reduced-motion: reduce) {
  .d12 .tf-up { transition: none; }
  .d12 .tf-up:active { transform: none; }
}

/* narrower than the 1440 design: tighten, then let the rows wrap instead of overflowing */
@media (max-width: 1360px) {
  .d12 .tf-in { padding: 0 24px; gap: 12px; }
  .d12 .tf-q input { width: 96px; }
}
@media (max-width: 1240px) {
  .d12 .tf-util .tf-in, .d12 .tf-bar .tf-in { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .d12 .tf-tools, .d12 .tf-r { margin-left: 0; flex-wrap: wrap; }
  .d12 .tf-pg .tf-in { overflow-x: auto; }
}
