/* ============================================================================
   對照表庫 (筆記表格) — component styles, namespaced .tb-
   Accent comes from --accent / --accent-pale on the panel (per subject).
   ==========================================================================*/

.tb-shell { position: relative; display: flex; gap: 18px; align-items: flex-start; }
.tb-side-toggle { display: none; }

/* ---- sidebar ---- */
.tb-side {
  flex: 0 0 240px; position: sticky; top: 74px;
  max-height: calc(100vh - 90px); overflow-y: auto;
  background: var(--paper-2, #FBF6EC); border: 1px solid var(--border, #E0D7C8);
  border-radius: 14px; padding: 14px 10px 12px;
}
.tb-side-head { padding: 0 8px 10px; border-bottom: 1px solid var(--border, #E0D7C8); margin-bottom: 8px; }
.tb-side-title { font-family: var(--font-serif, serif); font-weight: 700; font-size: 1.05rem; color: var(--ink, #2E2A25); }
.tb-side-sub { font-family: var(--font-sans, sans-serif); font-size: 12px; color: var(--ink-3, #6D6358); margin-top: 2px; }
.tb-search {
  width: 100%; box-sizing: border-box; margin: 0 0 8px;
  font-family: var(--font-sans, sans-serif); font-size: 13px;
  padding: 7px 10px; border: 1px solid var(--border, #E0D7C8); border-radius: 9px;
  background: var(--paper, #FFFDF8); color: var(--ink, #2E2A25);
}
.tb-search:focus { outline: none; border-color: var(--accent, #A83E2E); }
.tb-nav { display: flex; flex-direction: column; gap: 2px; }
.tb-nav-item {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-sans, sans-serif); font-size: 13px; line-height: 1.4;
  color: var(--ink-2, #4A4239); text-decoration: none;
  padding: 7px 9px; border-radius: 9px;
}
.tb-nav-item:hover { background: var(--paper-3, #F1E9DA); }
.tb-nav-item.is-on { background: var(--accent-pale, #F6E8E4); color: var(--accent, #A83E2E); font-weight: 500; }
.tb-nav-no {
  flex: 0 0 auto; font-size: 10.5px; color: var(--ink-3, #6D6358);
  background: var(--paper-3, #F1E9DA); border-radius: 6px; padding: 1px 5px; min-width: 20px; text-align: center;
}
.tb-nav-item.is-on .tb-nav-no { background: rgba(0,0,0,.08); }
.tb-nav-count {
  margin-left: auto; font-size: 10.5px; color: var(--ink-3, #6D6358);
  background: var(--paper-3, #F1E9DA); border-radius: 999px; padding: 1px 7px;
}
.tb-nav-empty { font-family: var(--font-sans, sans-serif); font-size: 12.5px; color: var(--ink-3, #6D6358); padding: 10px 8px; }

/* ---- main pane ---- */
.tb-main { flex: 1 1 auto; min-width: 0; }
.tb-crumb { margin-bottom: 8px; }
.tb-home-link {
  font-family: var(--font-sans, sans-serif); font-size: 13px;
  color: var(--accent, #A83E2E); text-decoration: none;
}
.tb-home-link:hover { text-decoration: underline; }
.tb-lesson-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tb-lesson-head h3 {
  font-family: var(--font-serif, serif); font-weight: 700; font-size: 1.25rem;
  color: var(--ink, #2E2A25); margin: 0;
}
.tb-lesson-meta { font-family: var(--font-sans, sans-serif); font-size: 12.5px; color: var(--ink-3, #6D6358); }
.tb-src {
  margin-left: auto; font-family: var(--font-sans, sans-serif); font-size: 12.5px;
  color: var(--accent, #A83E2E); text-decoration: none;
  border: 1px solid var(--accent, #A83E2E); border-radius: 999px; padding: 3px 12px;
}
.tb-src:hover { background: var(--accent-pale, #F6E8E4); }

/* welcome */
.tb-welcome {
  background: var(--paper-2, #FBF6EC); border: 1px solid var(--border, #E0D7C8);
  border-radius: 14px; padding: 26px 28px;
}
.tb-welcome h3 { font-family: var(--font-serif, serif); font-size: 1.35rem; margin: 0 0 8px; color: var(--ink, #2E2A25); }
.tb-welcome p { font-family: var(--font-sans, sans-serif); font-size: 14px; line-height: 1.9; color: var(--ink-2, #4A4239); margin: 0; }
.tb-sample-title { font-family: var(--font-sans, sans-serif); font-size: 12px; letter-spacing: .1em; color: var(--ink-3, #6D6358); margin: 18px 0 6px; }
.tb-sample { list-style: none; margin: 0; padding: 0; }
.tb-sample li { border-bottom: 1px dashed var(--border, #E0D7C8); }
.tb-sample-link {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  font-family: var(--font-sans, sans-serif); font-size: 13.5px;
  color: var(--ink-2, #4A4239); text-decoration: none; padding: 8px 2px;
}
.tb-sample-link:hover { color: var(--accent, #A83E2E); }
.tb-sample-src { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3, #6D6358); }

/* table cards */
.tb-group { margin-bottom: 20px; }
.tb-group-name {
  font-family: var(--font-sans, sans-serif); font-size: 13px; font-weight: 500;
  color: var(--accent, #A83E2E); margin: 0 0 8px;
}
.tb-card {
  background: var(--paper, #FFFDF8); border: 1px solid var(--border, #E0D7C8);
  border-radius: 12px; margin-bottom: 14px; overflow: hidden;
}
.tb-card-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 16px; background: var(--paper-2, #FBF6EC);
  border-bottom: 1px solid var(--border, #E0D7C8);
}
.tb-card-title { font-family: var(--font-sans, sans-serif); font-weight: 500; font-size: 14px; color: var(--ink, #2E2A25); }
.tb-card-meta { margin-left: auto; flex: 0 0 auto; font-family: var(--font-sans, sans-serif); font-size: 11px; color: var(--ink-3, #6D6358); }
.tb-card-body { padding: 6px 16px 12px; overflow-x: auto; }
.tb-empty {
  text-align: center; padding: 30px 18px; font-family: var(--font-sans, sans-serif);
  font-size: 13.5px; color: var(--ink-3, #6D6358);
  border: 1px dashed var(--border, #E0D7C8); border-radius: 12px;
}

/* extracted tables (class injected by build_tables.py) */
table.tb-table { border-collapse: collapse; width: 100%; margin: 8px 0 4px; }
table.tb-table th, table.tb-table td {
  border: 1px solid var(--border, #E0D7C8);
  font-family: var(--font-sans, sans-serif); font-size: 13px; line-height: 1.7;
  padding: 7px 11px; text-align: left; vertical-align: top; color: var(--ink-2, #4A4239);
}
table.tb-table th { background: var(--paper-2, #FBF6EC); font-weight: 500; color: var(--ink, #2E2A25); white-space: nowrap; }
table.tb-table tr:nth-child(even) td { background: rgba(0,0,0,.015); }

/* ---- mobile ---- */
@media (max-width: 860px) {
  .tb-shell { flex-direction: column; }
  .tb-side-toggle {
    display: block; position: absolute; top: 0; right: 0; z-index: 5;
    font-size: 16px; line-height: 1; padding: 7px 12px;
    background: var(--paper-2, #FBF6EC); border: 1px solid var(--border, #E0D7C8);
    border-radius: 9px; color: var(--ink-2, #4A4239); cursor: pointer;
  }
  .tb-side {
    position: static; max-height: none; flex: 1 1 auto; width: 100%;
    display: none;
  }
  .tb-shell.tb-side-open .tb-side { display: block; }
}

/* search hit highlight */
.tb-card.is-hit { border-color: var(--accent, #A83E2E); box-shadow: 0 0 0 3px rgba(168, 62, 46, .12); }

/* sidebar "全部課程" entry */
.tb-nav-all { font-weight: 600; border-bottom: 1px solid rgba(0,0,0,.08); margin-bottom: 4px; }
.tb-nav-all .tb-nav-no { background: var(--accent, #A83E2E); color: #fff; }
.tb-src--sm { font-size: 11.5px; font-weight: 400; margin-left: 8px; opacity: .8; }
