/* ==================================================
   common.css
   Hotai Finance Installment Platform v2
   Apple / Notion inspired design system
================================================== */

:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --line: #e5e7eb;

  --primary: #2556e8;
  --primary-hover: #1e49c9;
  --primary-soft: #eef4ff;

  --navy: #0f1f3d;
  --gold: #c89b3c;
  --gold-soft: #fff7e6;

  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --success: #16a34a;
  --success-soft: #ecfdf3;

  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-sm: 0 8px 24px rgba(15, 31, 61, 0.06);
  --shadow-md: 0 18px 48px rgba(15, 31, 61, 0.08);
  --shadow-lg: 0 28px 80px rgba(15, 31, 61, 0.12);

  --page-width: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 86, 232, 0.08), transparent 32%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--text);
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ================================
   Layout
================================ */

.hf-page {
  min-height: 100vh;
}

.hf-shell {
  width: min(var(--page-width), calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hf-page-center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.hf-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.hf-card-pad {
  padding: 32px;
}

.hf-grid {
  display: grid;
  gap: 20px;
}

.hf-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hf-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hf-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ================================
   Header
================================ */

.hf-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.hf-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hf-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 950;
  font-size: 22px;
  letter-spacing: -0.06em;
}

.hf-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.hf-title {
  margin: 0;
  color: var(--navy);
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 950;
  letter-spacing: -0.06em;
  line-height: 1.08;
}

.hf-subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 15px;
}

/* ================================
   Buttons
================================ */

.hf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hf-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  transition: 0.18s ease;
}

.hf-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.hf-btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.hf-btn-secondary:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.hf-btn-danger {
  background: var(--danger);
  color: #fff;
}

.hf-btn-danger:hover {
  background: #b91c1c;
}

/* ================================
   Pills / Status
================================ */

.hf-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.hf-pill-gold {
  background: var(--gold-soft);
  color: #8a620f;
}

.hf-pill-dark {
  background: var(--navy);
  color: #fff;
}

/* ================================
   Forms
================================ */

.hf-field {
  margin-bottom: 18px;
}

.hf-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-weight: 900;
}

.hf-input,
.hf-select,
.hf-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: 0.16s ease;
}

.hf-input,
.hf-select {
  height: 52px;
  padding: 0 16px;
}

.hf-textarea {
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

.hf-input:focus,
.hf-select:focus,
.hf-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 86, 232, 0.08);
}

/* ================================
   Notice / Empty
================================ */

.hf-notice {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  line-height: 1.7;
}

.hf-empty {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

/* ================================
   Dashboard Cards
================================ */

.hf-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.hf-menu-card {
  display: block;
  padding: 26px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: 0.18s ease;
}

.hf-menu-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hf-menu-icon {
  font-size: 30px;
  margin-bottom: 14px;
}

.hf-menu-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.hf-menu-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

/* ================================
   Section
================================ */

.hf-section {
  margin-top: 22px;
  padding: 26px;
}

.hf-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.hf-section-title {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
  letter-spacing: -0.03em;
}

.hf-list {
  display: grid;
  gap: 12px;
}

.hf-list-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid #edf0f5;
}

.hf-list-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
}

.hf-list-item span {
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}


/* 專案試算：僅顯示必要的專案注意事項 */
.hf-project-note {
  padding: 17px 18px;
  border: 1px solid #f1d6a8;
  border-left: 5px solid #d97706;
  border-radius: var(--radius-md);
  background: #fffaf0;
}

.hf-project-note-title {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 950;
}

.hf-project-note-lines {
  display: grid;
  gap: 5px;
}

.hf-project-note-lines p {
  margin: 0;
  color: #5f4a28;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 700;
}

/* ================================
   Footer
================================ */

.hf-footer {
  margin-top: 36px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ================================
   Responsive
================================ */

@media (max-width: 860px) {
  .hf-shell {
    width: min(100% - 24px, 720px);
    padding: 24px 0 40px;
  }

  .hf-topbar {
    display: block;
  }

  .hf-topbar .hf-actions {
    margin-top: 18px;
  }

  .hf-grid-2,
  .hf-grid-3,
  .hf-grid-4,
  .hf-menu-grid {
    grid-template-columns: 1fr;
  }

  .hf-card-pad {
    padding: 24px;
  }

  .hf-page-center {
    padding: 20px;
  }
}
/* ================================
   v8 Workbench / Admin Tabs / Panels
================================ */

.hf-workbench-hero {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(37, 86, 232, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
  border: 1px solid rgba(229, 231, 235, 0.95);
  box-shadow: var(--shadow-md);
  margin-bottom: 22px;
}

.hf-workbench-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--primary);
}

.hf-workbench-hero.is-toyota::before { background: #d71920; }
.hf-workbench-hero.is-lexus::before { background: var(--gold); }
.hf-workbench-hero.is-hfc::before { background: var(--navy); }

.hf-workbench-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.hf-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.hf-stat-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(229,231,235,.94);
}

.hf-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hf-stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 24px;
  letter-spacing: -0.04em;
}

.hf-action-card {
  position: relative;
  min-height: 188px;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border-radius: 28px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: .18s ease;
}

.hf-action-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: var(--primary);
  opacity: .9;
}

.hf-action-card.is-toyota::before { background: #d71920; }
.hf-action-card.is-lexus::before { background: var(--gold); }
.hf-action-card.is-hfc::before { background: var(--navy); }

.hf-action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.hf-action-card h3 {
  margin: 10px 0 8px;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.hf-action-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.hf-card-meta {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hf-card-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 950;
}

.hf-admin-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.hf-admin-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
  cursor: pointer;
}

.hf-admin-tab.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15,31,61,.18);
}

.hf-setting-panel {
  padding: 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, #fbfcff 0%, #f8fafc 100%);
  border: 1px solid #e9edf4;
  box-shadow: none;
  margin-bottom: 18px;
}

.hf-setting-panel-title {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 950;
}

.hf-panel-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 860px) {
  .hf-workbench-top { display: block; }
  .hf-stat-grid { grid-template-columns: 1fr; }
  .hf-admin-tabs { border-radius: 24px; position: static; }
  .hf-admin-tab { flex: 1; }
}


/* ================================
   LEXUS plan advisor
================================ */

.hf-advisor-card {
  position: relative;
  overflow: hidden;
}

.hf-advisor-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--gold), rgba(200,155,60,.28));
}

.hf-advisor-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.hf-advisor-result {
  margin-top: 22px;
}

.hf-advisor-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.hf-advisor-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #8a611f;
  font-weight: 900;
  font-size: 13px;
}

.hf-advisor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 820px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.hf-advisor-table th {
  padding: 14px 16px;
  background: #f8fafc;
  color: var(--navy);
  text-align: center;
  font-size: 13px;
  font-weight: 950;
  border-bottom: 1px solid var(--line);
}

.hf-advisor-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  vertical-align: middle;
  text-align: center;
}

.hf-advisor-table tr:last-child td {
  border-bottom: 0;
}

.hf-advisor-plan {
  font-weight: 950;
  color: var(--navy);
}

.hf-advisor-note {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 980px) {
  .hf-advisor-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .hf-advisor-toolbar {
    grid-template-columns: 1fr;
  }
}


/* v11 LEXUS comparison alignment */
.hf-advisor-table .hf-advisor-note,
.hf-advisor-table .hf-advisor-plan {
  text-align: center;
}

.hf-advisor-table strong {
  color: var(--navy);
}



/* =========================================
   v17 Responsive UI polish
   手機版改為精簡資訊、短卡片、窄表格
========================================= */

.table-wrap,
.hf-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.hf-result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.hf-result-table th,
.hf-result-table td {
  text-align: center;
}

.hf-result-rate-table {
  min-width: 360px;
}

.hf-result-matrix-table {
  min-width: 720px;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .hf-shell {
    width: min(100% - 20px, 560px);
    padding: 16px 0 30px;
  }

  .hf-topbar {
    margin-bottom: 18px;
  }

  .hf-brand-row {
    align-items: flex-start;
  }

  .hf-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 18px;
  }

  .hf-kicker {
    font-size: 11px;
  }

  .hf-title {
    font-size: 28px;
    letter-spacing: -0.05em;
  }

  .hf-subtitle {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
  }

  .hf-actions {
    width: 100%;
    gap: 8px;
  }

  .hf-actions .hf-btn {
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
  }

  .hf-card,
  .hf-card-pad,
  .hf-section,
  .hf-workbench-hero {
    border-radius: 24px;
  }

  .hf-card-pad,
  .hf-section {
    padding: 18px;
  }

  .hf-section {
    margin-top: 16px;
  }

  .hf-section-head {
    margin-bottom: 12px;
  }

  .hf-section-title {
    font-size: 22px;
  }

  .hf-workbench-hero {
    padding: 20px;
    margin-bottom: 16px;
  }

  .hf-workbench-hero .hf-title {
    font-size: 24px !important;
  }

  .hf-workbench-hero .hf-subtitle {
    display: none;
  }

  .hf-grid,
  .hf-grid-2,
  .hf-grid-3,
  .hf-advisor-toolbar,
  .hf-menu-grid,
  .hf-menu-grid[style] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .hf-input,
  .hf-select {
    height: 48px;
    padding: 0 14px;
    font-size: 16px;
  }

  .hf-field {
    margin-bottom: 12px;
  }

  .hf-field label {
    margin-bottom: 6px;
    font-size: 13px;
  }

  .hf-field div[style*="font-size:13px"],
  #projectHint,
  #modelLoanLimitHint {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  .hf-action-card {
    min-height: auto;
    padding: 16px 18px;
    border-radius: 22px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px 14px;
  }

  .hf-action-card::before {
    left: 22px;
    right: auto;
    width: 72px;
    height: 4px;
  }

  .hf-action-card h3 {
    margin: 8px 0 0;
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -0.04em;
  }

  .hf-action-card p {
    display: none;
  }

  .hf-card-meta {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
    padding: 0;
    justify-content: flex-end;
  }

  .hf-card-meta > span:first-child {
    display: none;
  }

  .hf-card-arrow {
    width: 36px;
    height: 36px;
  }

  .hf-list {
    gap: 10px;
  }

  .hf-list-item {
    padding: 14px;
  }

  .hf-list-item span {
    font-size: 13px;
    line-height: 1.55;
  }

  .hf-empty {
    padding: 18px;
    font-size: 14px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: initial !important;
  }

  /* 分期試算結果：手機不保留桌機寬表 */
  .hf-result-rate-table {
    min-width: 0 !important;
    table-layout: fixed;
  }

  .hf-result-rate-table th,
  .hf-result-rate-table td {
    padding: 13px 8px !important;
    font-size: 15px;
  }

  .hf-result-rate-table th:first-child,
  .hf-result-rate-table td:first-child {
    width: 38%;
  }

  .hf-result-rate-table th:not(:first-child),
  .hf-result-rate-table td:not(:first-child) {
    width: 62%;
  }

  .hf-result-rate-table tbody th {
    font-size: 18px !important;
  }

  .hf-result-rate-table tbody td {
    font-size: 18px !important;
    font-weight: 900;
  }

  .hf-result-matrix-table {
    min-width: 640px !important;
  }

  /* LEXUS 方案比較：手機精簡欄位 */
  .hf-advisor-summary {
    margin-top: 12px;
    gap: 8px;
  }

  .hf-advisor-summary span {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .hf-advisor-result .table-wrap {
    margin-top: 12px !important;
  }

  .hf-advisor-table {
    min-width: 0 !important;
    table-layout: fixed;
    border-radius: 18px;
  }

  .hf-advisor-table th,
  .hf-advisor-table td {
    padding: 12px 6px;
    font-size: 13px;
    line-height: 1.45;
    word-break: keep-all;
  }

  .hf-advisor-table th[data-mobile-hide],
  .hf-advisor-table td[data-mobile-hide] {
    display: none;
  }

  .hf-advisor-table th:nth-child(1),
  .hf-advisor-table td:nth-child(1) { width: 27%; }
  .hf-advisor-table th:nth-child(3),
  .hf-advisor-table td:nth-child(3) { width: 17%; }
  .hf-advisor-table th:nth-child(4),
  .hf-advisor-table td:nth-child(4) { width: 18%; }
  .hf-advisor-table th:nth-child(6),
  .hf-advisor-table td:nth-child(6) { width: 23%; }
  .hf-advisor-table th:nth-child(7),
  .hf-advisor-table td:nth-child(7) { width: 15%; }

  .hf-advisor-plan {
    font-size: 15px;
    line-height: 1.35;
  }

  .hf-advisor-table strong {
    font-size: 14px;
  }

  .hf-footer {
    margin-top: 24px;
    font-size: 12px;
  }
}

@media (max-width: 390px) {
  .hf-shell {
    width: min(100% - 16px, 520px);
  }

  .hf-section,
  .hf-card-pad {
    padding: 16px;
  }

  .hf-advisor-table th,
  .hf-advisor-table td {
    padding: 11px 5px;
    font-size: 12px;
  }

  .hf-advisor-plan {
    font-size: 14px;
  }
}

/* =========================================
   v18 Consistent mobile UI
   - Subpage back button stays beside title
   - Admin tabs scroll horizontally
   - Wide result tables freeze first column
========================================= */

.hf-subpage-topbar {
  justify-content: space-between;
  align-items: center;
}

.hf-title-back-row {
  align-items: center;
  gap: 14px;
}

.hf-table-scroll,
.table-wrap {
  position: relative;
}

.hf-freeze-first th:first-child,
.hf-freeze-first td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 8px 0 12px rgba(15, 31, 61, 0.06);
}

.hf-freeze-first thead th:first-child {
  z-index: 5;
  background: #f8fafc;
}

.hf-freeze-first tbody th:first-child {
  z-index: 4;
  background: #fff;
}

@media (max-width: 768px) {
  .hf-subpage-topbar {
    display: block;
  }

  .hf-title-back-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .hf-title-back-row > .hf-btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 13px;
    white-space: nowrap;
  }

  .hf-title-back-row > div:last-child {
    min-width: 0;
  }

  .hf-title-back-row .hf-title {
    font-size: 28px;
  }

  .hf-title-back-row .hf-subtitle {
    word-break: break-word;
  }

  .hf-admin-tabs {
    position: static;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px;
    border-radius: 999px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .hf-admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .hf-admin-tab {
    flex: 0 0 auto !important;
    white-space: nowrap;
    min-width: auto;
    padding: 0 16px;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
  }

  .hf-table-scroll,
  .table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .hf-result-table,
  .hf-advisor-table {
    table-layout: auto !important;
  }

  .hf-compact-result-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  .hf-wide-result-table,
  .hf-result-matrix-table {
    min-width: 720px !important;
  }

  .hf-advisor-table.hf-freeze-first {
    min-width: 620px !important;
  }

  .hf-freeze-first th:first-child,
  .hf-freeze-first td:first-child {
    min-width: 92px;
    max-width: 112px;
    white-space: normal;
  }

  .hf-freeze-first th:not(:first-child),
  .hf-freeze-first td:not(:first-child) {
    min-width: 96px;
    white-space: nowrap;
  }

  .hf-advisor-table th[data-mobile-hide],
  .hf-advisor-table td[data-mobile-hide] {
    display: none;
  }

  .hf-advisor-table th,
  .hf-advisor-table td {
    padding: 12px 10px !important;
  }

  .hf-advisor-plan {
    font-size: 15px;
  }
}

@media (max-width: 768px) {
  .hf-wide-result-table.hf-result-rate-table th:first-child,
  .hf-wide-result-table.hf-result-rate-table td:first-child,
  .hf-wide-result-table.hf-result-rate-table th:not(:first-child),
  .hf-wide-result-table.hf-result-rate-table td:not(:first-child) {
    width: auto !important;
  }

  .hf-advisor-table.hf-freeze-first th,
  .hf-advisor-table.hf-freeze-first td {
    width: auto !important;
  }
}


/* =========================================
   v19: mobile consistency + real frozen first column
========================================= */

/* Any table that should freeze the first column must be inside a horizontal scroller. */
.hf-table-scroll,
.table-wrap,
.hf-scroll-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.hf-table-scroll table,
.table-wrap table,
.hf-scroll-table-wrap table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* Remove table overflow clipping, otherwise iOS Safari can fail sticky cells. */
.hf-freeze-first,
.hf-result-table,
.hf-advisor-table {
  overflow: visible !important;
}

.hf-freeze-first th:first-child,
.hf-freeze-first td:first-child {
  position: -webkit-sticky !important;
  position: sticky !important;
  left: 0 !important;
  z-index: 30 !important;
  background: #fff !important;
  box-shadow: 10px 0 14px rgba(15,31,61,.10) !important;
  background-clip: padding-box !important;
}

.hf-freeze-first thead th:first-child {
  z-index: 40 !important;
  background: #f8fafc !important;
}

.hf-freeze-first tbody th:first-child {
  z-index: 35 !important;
  background: #fff !important;
}

/* Home logout is kept only on workbench pages. */
.hf-home-topbar .hf-actions {
  margin-left: auto;
}

@media (max-width: 768px) {
  .hf-home-topbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 12px !important;
  }

  .hf-home-topbar .hf-brand-row {
    min-width: 0;
  }

  .hf-home-topbar .hf-title {
    font-size: 30px;
  }

  .hf-home-topbar .hf-actions {
    flex: 0 0 auto;
  }

  .hf-home-topbar .hf-actions .hf-btn {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
  }

  .hf-menu-grid,
  .hf-menu-grid[style] {
    grid-template-columns: 1fr !important;
  }

  .hf-action-card {
    min-height: 96px !important;
    padding: 18px !important;
  }

  .hf-action-card h3 {
    margin-top: 4px !important;
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  .hf-action-card p {
    display: none !important;
  }

  .hf-card-meta {
    margin-top: 14px !important;
    padding-top: 0 !important;
  }

  /* Subpage header: back button always stays directly left of the title. */
  .hf-subpage-topbar,
  .tool-topbar {
    display: block !important;
  }

  .hf-title-back-row,
  .tool-topbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .hf-title-back-row > .hf-btn,
  .tool-topbar .back-home-link {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  .hf-title-back-row > div,
  .tool-topbar > div {
    min-width: 0 !important;
  }

  /* Admin tabs: one-line horizontal chips, never vertical text. */
  .hf-admin-tabs {
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-radius: 24px !important;
    padding: 10px !important;
    gap: 8px !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .hf-admin-tabs::-webkit-scrollbar { display: none; }

  .hf-admin-tab {
    flex: 0 0 auto !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: nowrap !important;
    min-width: max-content !important;
    padding: 0 16px !important;
  }

  /* Wide tables: first column fixed, remaining columns scroll horizontally. */
  .hf-freeze-first {
    width: max-content !important;
    min-width: 720px !important;
    table-layout: auto !important;
  }

  .hf-compact-result-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  .hf-compact-result-table th:first-child,
  .hf-compact-result-table td:first-child,
  .hf-compact-result-table tbody th:first-child {
    position: static !important;
    box-shadow: none !important;
  }

  .hf-wide-result-table,
  .hf-result-matrix-table {
    min-width: 760px !important;
  }

  .hf-advisor-table.hf-freeze-first {
    min-width: 620px !important;
  }

  .hf-freeze-first th:first-child,
  .hf-freeze-first td:first-child {
    min-width: 96px !important;
    max-width: 118px !important;
    white-space: normal !important;
  }

  .hf-freeze-first th:not(:first-child),
  .hf-freeze-first td:not(:first-child) {
    min-width: 104px !important;
    white-space: nowrap !important;
  }

  .hf-advisor-table th,
  .hf-advisor-table td {
    padding: 12px 10px !important;
    font-size: 13px !important;
  }
}

/* =========================================
   v21: mobile header title / user info fix
   避免首頁標題與 email 在手機版被右上登出鈕擠成窄欄
========================================= */

.hf-title,
.hf-section-title,
.hf-action-card h3 {
  word-break: keep-all;
  overflow-wrap: normal;
  line-break: strict;
}

.hf-brand-row > div:last-child,
.hf-title-back-row > div:last-child {
  min-width: 0;
}

@media (max-width: 768px) {
  .hf-home-topbar {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    column-gap: 12px !important;
  }

  .hf-home-topbar .hf-brand-row {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    gap: 10px !important;
  }

  .hf-home-topbar .hf-brand-row > div:last-child {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .hf-home-topbar .hf-brand-mark {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 14px !important;
  }

  .hf-home-topbar .hf-kicker {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .hf-home-topbar .hf-title {
    max-width: 100% !important;
    font-size: clamp(28px, 9vw, 34px) !important;
    line-height: 1.12 !important;
    letter-spacing: -0.045em !important;
    white-space: normal !important;
  }

  .hf-home-topbar .hf-subtitle {
    max-width: 100% !important;
    margin-top: 8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    line-height: 1.45 !important;
  }

  .hf-home-topbar .hf-actions {
    width: auto !important;
    min-width: max-content !important;
    justify-self: end !important;
    align-self: start !important;
  }

  .hf-home-topbar .hf-actions .hf-btn,
  .hf-home-topbar #logoutBtn {
    min-width: 74px !important;
    min-height: 44px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* 子頁標題同樣避免被回首頁按鈕擠到碎裂 */
  .hf-title-back-row > div:last-child {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .hf-title-back-row .hf-title {
    word-break: keep-all !important;
    line-height: 1.12 !important;
  }

  .hf-title-back-row .hf-subtitle {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: keep-all !important;
  }
}

@media (max-width: 380px) {
  .hf-home-topbar .hf-title {
    font-size: 28px !important;
  }

  .hf-home-topbar .hf-brand-mark {
    display: none !important;
  }

  .hf-home-topbar .hf-actions .hf-btn,
  .hf-home-topbar #logoutBtn {
    min-width: 68px !important;
    padding: 0 14px !important;
  }
}

/* =========================================
   v21.2 Unified subpage UI
   讓從首頁進入的工具頁：專案試算 / 方案比較 / 車貸補貼息，使用同一套版型
========================================= */

.hf-subpage-shell {
  padding-top: 42px;
}

.hf-subpage-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-bottom: 28px;
}

.hf-back-btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--navy);
  text-decoration: none;
  font-weight: 950;
  white-space: nowrap;
}

.hf-back-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.hf-subpage-heading {
  min-width: 0;
}

.hf-user-line {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hf-tool-card,
.hf-result-section {
  width: 100%;
}

.hf-section-main-title {
  margin: 14px 0 0;
  color: var(--navy);
  font-size: 32px;
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1.15;
}

.hf-tool-head {
  margin-bottom: 20px;
}

.hf-tool-panel {
  margin-bottom: 0;
}

.hf-field-hint,
.hf-field-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.hf-form-actions {
  margin-top: 22px;
}

.hf-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hf-result-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.hf-result-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 6px;
}

.hf-result-card strong {
  display: block;
  color: var(--navy);
  font-size: 24px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.hf-advisor-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.hf-advisor-toolbar .hf-field {
  margin-bottom: 0 !important;
}

.hf-advisor-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.hf-advisor-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #8a620f;
  font-weight: 900;
  font-size: 13px;
}

.hf-scroll-table-wrap,
.hf-table-scroll,
.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
}

.hf-result-table,
.hf-advisor-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: visible;
}

.hf-advisor-table th,
.hf-advisor-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.hf-advisor-table th {
  background: #f8fbfb;
  color: var(--navy);
  font-weight: 950;
}

.hf-advisor-table td:first-child,
.hf-advisor-table th:first-child,
.hf-freeze-first td:first-child,
.hf-freeze-first th:first-child,
.hf-freeze-first tbody th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 12px 0 18px rgba(15, 31, 61, 0.08);
}

.hf-freeze-first thead th:first-child,
.hf-advisor-table thead th:first-child {
  z-index: 5;
  background: #f8fbfb;
}

.hf-advisor-plan {
  font-weight: 950;
  color: var(--navy);
}

.hf-advisor-note {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1080px) {
  .hf-advisor-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .hf-shell,
  .hf-subpage-shell {
    width: min(100% - 24px, 720px) !important;
    padding-top: 22px !important;
  }

  .hf-subpage-header {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
  }

  .hf-back-btn {
    width: max-content !important;
    min-height: 42px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    order: -1;
  }

  .hf-subpage-header .hf-title {
    font-size: clamp(30px, 9vw, 40px) !important;
    line-height: 1.08 !important;
    letter-spacing: -0.055em !important;
    word-break: keep-all !important;
  }

  .hf-subpage-header .hf-subtitle {
    margin-top: 8px !important;
    font-size: 14px !important;
  }

  .hf-section,
  .hf-card-pad {
    padding: 22px !important;
    border-radius: 28px !important;
  }

  .hf-section-main-title {
    font-size: 30px !important;
    margin-top: 12px !important;
  }

  .hf-setting-panel {
    padding: 18px !important;
    border-radius: 22px !important;
  }

  .hf-grid-2,
  .hf-advisor-toolbar {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .hf-field {
    margin-bottom: 14px !important;
  }

  .hf-input,
  .hf-select {
    height: 54px !important;
    border-radius: 18px !important;
    font-size: 16px !important;
  }

  .hf-form-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
  }

  .hf-form-actions .hf-btn {
    flex: 0 0 auto;
    min-height: 48px !important;
  }

  .hf-result-grid {
    grid-template-columns: 1fr !important;
  }

  .hf-result-card {
    padding: 16px !important;
  }

  .hf-result-card strong {
    font-size: 22px !important;
  }

  .hf-advisor-summary {
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .hf-advisor-summary span {
    min-height: 30px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }

  /* 手機：3 欄以上的表格採第一欄凍結，其餘欄位左右滑動 */
  .hf-scroll-table-wrap,
  .hf-table-scroll,
  .table-wrap {
    overflow-x: auto !important;
    overflow-y: visible !important;
    border-radius: 18px !important;
  }

  .hf-freeze-first,
  .hf-advisor-table.hf-freeze-first {
    width: max-content !important;
    min-width: 640px !important;
    table-layout: auto !important;
  }

  .hf-compact-result-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }

  .hf-compact-result-table th:first-child,
  .hf-compact-result-table td:first-child,
  .hf-compact-result-table tbody th:first-child {
    position: static !important;
    box-shadow: none !important;
  }

  .hf-advisor-table th,
  .hf-advisor-table td,
  .hf-result-table th,
  .hf-result-table td,
  .hf-result-table tbody th {
    padding: 12px 10px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  .hf-advisor-table th:first-child,
  .hf-advisor-table td:first-child,
  .hf-freeze-first th:first-child,
  .hf-freeze-first td:first-child,
  .hf-freeze-first tbody th:first-child {
    min-width: 86px !important;
    max-width: 104px !important;
    white-space: normal !important;
  }

  [data-mobile-hide] {
    display: none !important;
  }
}

/* =========================================
   v22 Themed subpage accents
   子頁面依首頁品牌顏色顯示一致 accent
========================================= */

body.hf-theme-hfc {
  --theme-accent: var(--navy);
  --theme-accent-soft: #eef3ff;
  --theme-accent-faint: rgba(15, 31, 61, 0.08);
  --theme-accent-text: var(--navy);
  --theme-accent-shadow: rgba(15, 31, 61, 0.10);
}

body.hf-theme-lexus {
  --theme-accent: var(--gold);
  --theme-accent-soft: var(--gold-soft);
  --theme-accent-faint: rgba(200, 155, 60, 0.13);
  --theme-accent-text: #8a620f;
  --theme-accent-shadow: rgba(200, 155, 60, 0.16);
}

body.hf-theme-toyota {
  --theme-accent: #d71920;
  --theme-accent-soft: #fff1f2;
  --theme-accent-faint: rgba(215, 25, 32, 0.10);
  --theme-accent-text: #a30f16;
  --theme-accent-shadow: rgba(215, 25, 32, 0.14);
}

.hf-subpage-shell .hf-card,
.hf-subpage-shell .hf-tool-card,
.hf-subpage-shell .hf-result-section {
  position: relative;
  overflow: hidden;
}

.hf-subpage-shell .hf-tool-card::before,
.hf-subpage-shell .hf-result-section::before,
.hf-subpage-shell > .hf-card:first-of-type::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--theme-accent), color-mix(in srgb, var(--theme-accent) 25%, transparent));
  z-index: 1;
}

.hf-subpage-shell .hf-section-head,
.hf-subpage-shell .hf-setting-panel,
.hf-subpage-shell .hf-list,
.hf-subpage-shell .hf-empty,
.hf-subpage-shell .hf-result-grid,
.hf-subpage-shell .hf-advisor-result {
  position: relative;
  z-index: 2;
}

body.hf-theme-hfc .hf-pill,
body.hf-theme-hfc .hf-back-btn:hover,
body.hf-theme-hfc .hf-notice,
body.hf-theme-lexus .hf-pill,
body.hf-theme-lexus .hf-back-btn:hover,
body.hf-theme-lexus .hf-notice,
body.hf-theme-toyota .hf-pill,
body.hf-theme-toyota .hf-back-btn:hover,
body.hf-theme-toyota .hf-notice {
  background: var(--theme-accent-soft);
  color: var(--theme-accent-text);
}

body.hf-theme-hfc .hf-pill,
body.hf-theme-lexus .hf-pill,
body.hf-theme-toyota .hf-pill {
  border: 1px solid color-mix(in srgb, var(--theme-accent) 20%, transparent);
}

body.hf-theme-hfc .hf-pill-dark,
body.hf-theme-hfc .hf-brand-mark,
body.hf-theme-hfc .hf-admin-tab.is-active {
  background: var(--navy);
  color: #fff;
}

body.hf-theme-lexus .hf-pill-gold,
body.hf-theme-lexus .hf-brand-mark,
body.hf-theme-lexus .hf-admin-tab.is-active {
  background: var(--gold);
  color: #fff;
}

body.hf-theme-toyota .hf-brand-mark,
body.hf-theme-toyota .hf-admin-tab.is-active {
  background: #d71920;
  color: #fff;
}

body.hf-theme-hfc .hf-section-main-title::after,
body.hf-theme-lexus .hf-section-main-title::after,
body.hf-theme-toyota .hf-section-main-title::after,
body.hf-theme-hfc .hf-section-title::after,
body.hf-theme-lexus .hf-section-title::after,
body.hf-theme-toyota .hf-section-title::after {
  content: "";
  display: block;
  width: 52px;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--theme-accent);
  opacity: .9;
}

body.hf-theme-hfc .hf-input:focus,
body.hf-theme-hfc .hf-select:focus,
body.hf-theme-hfc .hf-textarea:focus,
body.hf-theme-lexus .hf-input:focus,
body.hf-theme-lexus .hf-select:focus,
body.hf-theme-lexus .hf-textarea:focus,
body.hf-theme-toyota .hf-input:focus,
body.hf-theme-toyota .hf-select:focus,
body.hf-theme-toyota .hf-textarea:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 4px var(--theme-accent-faint);
}

body.hf-theme-hfc .hf-result-card,
body.hf-theme-lexus .hf-result-card,
body.hf-theme-toyota .hf-result-card {
  border-top: 3px solid var(--theme-accent);
}

/* 取代舊版只給 LEXUS 方案比較的金色條，改吃頁面 theme */
.hf-advisor-card::before {
  background: linear-gradient(90deg, var(--theme-accent), color-mix(in srgb, var(--theme-accent) 25%, transparent)) !important;
}

@media (max-width: 768px) {
  .hf-subpage-shell .hf-tool-card::before,
  .hf-subpage-shell .hf-result-section::before,
  .hf-subpage-shell > .hf-card:first-of-type::before {
    height: 4px;
  }

  body.hf-theme-hfc .hf-section-main-title::after,
  body.hf-theme-lexus .hf-section-main-title::after,
  body.hf-theme-toyota .hf-section-main-title::after,
  body.hf-theme-hfc .hf-section-title::after,
  body.hf-theme-lexus .hf-section-title::after,
  body.hf-theme-toyota .hf-section-title::after {
    width: 42px;
    height: 3px;
    margin-top: 8px;
  }
}


/* ================================
   Admin entry link on public login
================================ */
.hf-admin-entry-link {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(203,213,225,.9);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .10);
  backdrop-filter: blur(14px);
  transition: .18s ease;
}

.hf-admin-entry-link:hover {
  color: var(--navy);
  background: #fff;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .hf-admin-entry-link {
    right: 14px;
    bottom: 14px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }
}

/* v25 admin brand navigation */
@media (max-width: 768px) {
  .hf-topbar .hf-actions {
    max-width: 100%;
  }

  #adminBrandLinks {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  #adminBrandLinks::-webkit-scrollbar {
    display: none;
  }
}


/* v26 LEXUS advisor selected model price */
.hf-model-price-note {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px 12px;
  margin-top:14px;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(255,255,255,.78);
  color:var(--muted);
  font-size:14px;
}
.hf-model-price-note[hidden] { display:none !important; }
.hf-model-price-note strong { color:var(--navy); font-size:15px; }
@media (max-width:768px) {
  .hf-model-price-note { display:grid; grid-template-columns:auto 1fr; }
}


/* v27: 方案比較 → 完整試算導覽 */
.hf-advisor-clickable-row {
  cursor: pointer;
  transition: background-color .16s ease;
}

.hf-advisor-clickable-row:hover,
.hf-advisor-clickable-row:focus-visible {
  background: color-mix(in srgb, var(--theme-accent, var(--primary)) 7%, #fff);
  outline: none;
}

.hf-advisor-action-head,
.hf-advisor-action-cell {
  white-space: nowrap;
}

.hf-advisor-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--theme-accent, var(--primary));
  background: color-mix(in srgb, var(--theme-accent, var(--primary)) 10%, #fff);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.hf-advisor-return {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 14px;
  color: var(--theme-accent, var(--primary));
  font-weight: 900;
  text-decoration: none;
}

.hf-target-result-row > * {
  background: color-mix(in srgb, var(--theme-accent, var(--primary)) 12%, #fff) !important;
}

@media (max-width: 768px) {
  .hf-advisor-action-head,
  .hf-advisor-action-cell {
    min-width: 132px;
  }

  .hf-advisor-detail-link {
    font-size: 12px;
    padding: 6px 8px;
  }
}


/* v28：子頁返回導覽與管理員預覽按鈕 */
.hf-subpage-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.hf-back-btn-secondary {
  border-color: color-mix(in srgb, var(--theme-accent, var(--primary)) 24%, var(--line));
  color: var(--theme-accent, var(--primary));
  background: color-mix(in srgb, var(--theme-accent, var(--primary)) 7%, #fff);
}

.hf-back-btn-secondary:hover {
  background: color-mix(in srgb, var(--theme-accent, var(--primary)) 13%, #fff);
  color: var(--theme-accent, var(--primary));
}

@media (max-width: 768px) {
  .hf-subpage-nav {
    width: 100%;
    gap: 8px;
  }

  .hf-subpage-nav .hf-back-btn {
    width: max-content !important;
  }
}

/* TOYOTA advisor trial */
.hf-detail-link {
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.hf-detail-link:hover { text-decoration: underline; }


.hf-advisor-note ul {
  margin: 0;
  padding-left: 1.3rem;
}

.hf-advisor-note li {
  margin: 6px 0;
  line-height: 1.65;
}

/* v36：公告／文件附件 */
.hf-choice-chip {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:900;
}

.hf-content-card {
  gap:10px;
}

.hf-content-copy {
  white-space:pre-wrap;
  line-height:1.8;
}

.hf-announcement-media {
  margin-top:14px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:18px;
  background:#f8fafc;
}

.hf-announcement-media img {
  display:block;
  width:100%;
  max-height:720px;
  object-fit:contain;
  background:#fff;
}

.hf-document-preview iframe,
.hf-text-preview {
  display:block;
  width:100%;
  height:min(72vh,760px);
  border:0;
  background:#fff;
}

.hf-file-inline-note {
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
  line-height:1.6;
  overflow-wrap:anywhere;
}

.hf-file-actions {
  margin-top:14px;
}

@media (max-width:768px) {
  .hf-document-preview iframe,
  .hf-text-preview {
    height:62vh;
  }
}


/* v38 zero-interest rate groups */
.hf-zero-rate-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hf-zero-rate-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.hf-zero-rate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.hf-zero-rate-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.hf-zero-rate-head strong {
  color: var(--navy);
  font-size: 20px;
  font-weight: 950;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .hf-zero-rate-groups {
    grid-template-columns: 1fr;
  }

  .hf-zero-rate-group {
    padding: 16px;
    border-radius: 18px;
  }

  .hf-zero-rate-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

/* v49 login password update notice */
.hf-login-update-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid #f2c66d;
  border-radius: 18px;
  background: #fff8e8;
  color: #5f4200;
  box-shadow: 0 10px 28px rgba(117, 77, 0, 0.08);
}

.hf-login-update-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #ffe6a6;
  font-size: 23px;
  line-height: 1;
}

.hf-login-update-notice strong {
  display: block;
  margin-bottom: 4px;
  color: #493300;
  font-size: 15px;
  font-weight: 950;
}

.hf-login-update-notice p {
  margin: 0;
  color: #694b08;
  line-height: 1.7;
  font-size: 14px;
  font-weight: 750;
}
