/* ===== FTBridge Design System ===== */
:root {
  --bg: #f8fafc;
  --fg: #2563eb;
  --accent: #06b6d4;
  --surface: #ffffff;
  --muted: #7c3aed;
  --border: #dae5fa;
  --success: #16a34a;

  --radius: 8px;
  --border-width: 1px;
  --grid: 8px;

  --font-display: Inter, system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-body: Inter, system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;

  --topnav-h: 56px;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--muted); }

/* ===== App Shell ===== */
.app { display: flex; flex-direction: column; height: 100vh; }

.topnav {
  height: var(--topnav-h);
  background: var(--surface);
  border-bottom: var(--border-width) solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  gap: 16px; flex-shrink: 0; z-index: 100;
}
.topnav-brand {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--fg), var(--muted));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: 24px;
}
.topnav-search {
  flex: 1; max-width: 480px;
  position: relative;
}
.topnav-search input {
  width: 100%; height: 36px; padding: 0 16px 0 36px;
  border: var(--border-width) solid var(--border); border-radius: 18px;
  background: var(--bg); font-size: 13px; outline: none;
}
.topnav-search input:focus { border-color: var(--fg); }
.topnav-search::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 13px; opacity: 0.5;
}
.topnav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topnav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--fg), var(--muted));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.app-body { display: flex; flex: 1; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: var(--border-width) solid var(--border);
  overflow-y: auto; flex-shrink: 0;
  padding: 16px 0;
}
.sidebar-section { padding: 0 16px; margin-bottom: 8px; }
.sidebar-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); opacity: 0.6;
  padding: 8px 0;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius); font-size: 13px; cursor: pointer;
  transition: background .15s; color: var(--fg);
}
.sidebar-item:hover { background: var(--bg); }
.sidebar-item.active { background: var(--border); font-weight: 600; }
.sidebar-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); flex-shrink: 0;
}
.sidebar-badge {
  margin-left: auto; font-size: 11px; padding: 1px 8px;
  border-radius: 10px; background: var(--muted); color: #fff;
}

/* ===== Main Content ===== */
.main {
  flex: 1; overflow-y: auto; padding: 24px 32px;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; font-family: var(--font-display); }
.page-actions { display: flex; gap: 8px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: var(--border-width) solid transparent;
  transition: all .15s; white-space: nowrap;
  font-family: var(--font-body);
}
.btn-primary { background: var(--fg); color: #fff; border-color: var(--fg); }
.btn-primary:hover { background: rgba(37, 99, 235, 0.85); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { opacity: 0.85; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-ghost { background: transparent; color: var(--fg); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Cards ===== */
.card {
  background: var(--surface); border: var(--border-width) solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body { }

/* ===== Stat Cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--surface); border: var(--border-width) solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.stat-label { font-size: 12px; color: var(--muted); opacity: 0.7; margin-bottom: 4px; }
.stat-value {
  font-size: 28px; font-weight: 700; font-family: var(--font-display);
  color: var(--fg);
}
.stat-change { font-size: 12px; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.highlight { color: var(--muted); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
thead { background: var(--bg); }
th {
  text-align: left; padding: 12px 16px;
  font-weight: 700; font-size: 12px; color: var(--muted);
  border-bottom: var(--border-width) solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: var(--border-width) solid var(--border);
}
tr:hover td { background: var(--bg); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--fg);
}
.form-label .required { color: var(--muted); margin-left: 2px; }
.form-input {
  width: 100%; padding: 8px 12px;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius); font-size: 13px;
  background: var(--surface); outline: none;
  font-family: var(--font-body);
}
.form-input:focus { border-color: var(--fg); }
textarea.form-input { min-height: 100px; resize: vertical; }
select.form-input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232563eb' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: var(--border-width) solid var(--border); }

/* ===== Search Bar ===== */
.search-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 16px; background: var(--surface); border: var(--border-width) solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px;
}
.search-bar .form-input { max-width: 360px; }
.filter-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tag {
  padding: 4px 12px; border-radius: 14px; font-size: 12px;
  background: var(--bg); border: var(--border-width) solid var(--border);
  cursor: pointer; transition: all .15s;
}
.filter-tag:hover { border-color: var(--fg); }
.filter-tag.active { background: var(--fg); color: #fff; border-color: var(--fg); }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge-blue { background: var(--border); color: var(--fg); }
.badge-purple { background: rgba(124, 58, 237, 0.1); color: var(--muted); }
.badge-green { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.badge-cyan { background: rgba(6, 182, 212, 0.1); color: var(--accent); }

/* ===== Tags ===== */
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; background: var(--bg); border: var(--border-width) solid var(--border); color: var(--fg);
}

/* ===== Tabs ===== */
.tabs {
  display: flex; gap: 0; border-bottom: var(--border-width) solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
  color: var(--muted); transition: all .15s;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--fg); }

/* ===== Modals ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  width: 90%; max-width: 600px; max-height: 80vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: var(--border-width) solid var(--border);
  font-size: 15px; font-weight: 700;
}
.modal-close {
  width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; font-size: 18px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 16px 20px; border-top: var(--border-width) solid var(--border);
}

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 20px;
}
.page-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: var(--border-width) solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-size: 13px; transition: all .15s;
}
.page-btn:hover { border-color: var(--fg); }
.page-btn.active { background: var(--fg); color: #fff; border-color: var(--fg); }

/* ===== Status Dots ===== */
.status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
}
.status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
}
.status-pending::before { background: var(--accent); }
.status-active::before { background: var(--fg); }
.status-done::before { background: var(--success); }
.status-reject::before { background: var(--muted); }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative; padding-bottom: 20px;
}
.timeline-item::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--fg);
}
.timeline-item.done::before { background: var(--success); border-color: var(--success); }
.timeline-date { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.timeline-title { font-size: 13px; font-weight: 600; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center; padding: 64px 20px; color: var(--muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-desc { font-size: 13px; }

/* ===== Detail Panel ===== */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px;
}
.detail-item { }
.detail-label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.detail-value { font-size: 14px; font-weight: 600; }

/* ===== Info Cards (for lists) ===== */
.info-card {
  display: flex; gap: 16px; padding: 16px;
  background: var(--surface); border: var(--border-width) solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px;
  transition: box-shadow .15s; cursor: pointer;
}
.info-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.info-card-avatar {
  width: 48px; height: 48px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--fg), var(--muted));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.info-card-body { flex: 1; min-width: 0; }
.info-card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.info-card-desc { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.info-card-meta { display: flex; gap: 16px; flex-wrap: wrap; }
.info-card-meta span { font-size: 12px; color: var(--muted); }
.info-card-right { text-align: right; flex-shrink: 0; }

/* ===== Checklist / Progress ===== */
.checklist { }
.checklist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: var(--border-width) solid var(--border);
}
.checklist-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}
.checklist-check.done { border-color: var(--success); background: var(--success); color: #fff; }

/* ===== Process Flow ===== */
.process-flow {
  display: flex; align-items: center; gap: 0; padding: 24px 0;
  flex-wrap: wrap;
}
.process-step {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: var(--border-width) solid var(--border);
  font-size: 13px; font-weight: 600;
}
.process-step.active { border-color: var(--fg); background: var(--border); }
.process-step.done { border-color: var(--success); }
.process-arrow {
  font-size: 18px; color: var(--border); margin: 0 4px;
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--muted); opacity: 0.7; }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Section title ===== */
.section-title {
  font-size: 16px; font-weight: 700; font-family: var(--font-display);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: var(--border-width) solid var(--border);
}

/* ===== Notification dot ===== */
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); display: inline-block;
}

/* ===== Service Page Components ===== */
.service-card {
  padding: 20px; border: var(--border-width) solid var(--border);
  border-radius: var(--radius); transition: box-shadow .15s;
}
.service-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.service-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--border); display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; flex-shrink: 0;
}
.service-icon svg { width: 22px; height: 22px; color: var(--fg); }
.service-card-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.service-card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }

.process-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.process-step-num.active { background: var(--fg); color: #ffffff; }
.process-step-num:not(.active) { background: var(--border); color: var(--muted); }

.process-desc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 24px;
  font-size: 12px; color: var(--muted); line-height: 1.6; padding-top: 24px;
  border-top: var(--border-width) solid var(--border);
}
.process-desc-item strong { color: var(--fg); display: block; margin-bottom: 4px; }

.partner-card {
  text-align: center; padding: 24px 12px;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
}
.partner-logo {
  width: 56px; height: 56px; border-radius: var(--radius);
  margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  color: #ffffff; font-size: 14px; font-weight: 700;
}
.partner-logo.g1 { background: linear-gradient(135deg, var(--fg), var(--muted)); }
.partner-logo.g2 { background: linear-gradient(135deg, var(--muted), var(--fg)); }
.partner-logo.g3 { background: linear-gradient(135deg, var(--fg), var(--accent)); }
.partner-logo.g4 { background: linear-gradient(135deg, var(--accent), var(--success)); }
.partner-name { font-size: 13px; font-weight: 600; }

.about-visual {
  background: linear-gradient(135deg, var(--fg), var(--muted));
  border-radius: var(--radius); min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: #ffffff; padding: 32px; text-align: center;
}
.about-visual-quote { font-size: 20px; font-weight: 700; line-height: 1.4; }

@media (max-width: 780px) {
  .process-desc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .process-desc-grid { grid-template-columns: 1fr; }
}

/* ===== Two-column layout ===== */
.col-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.col-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.col-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 1024px) {
  .col-2, .col-3, .col-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ===== Floating Controls Stack ===== */
.afu-float-btn {
  position: fixed;
  bottom: 88px;
  right: 20px;
  z-index: 996;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--fg);
  border: var(--border-width) solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, .12);
  transition: transform .2s, box-shadow .2s;
}
.afu-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37, 99, 235, .2);
}
.afu-float-label {
  display: none;
}

/* ===== Prototype Navigation Tool ===== */
.nav-float-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 996;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--fg);
  border: var(--border-width) solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
  transition: transform .2s, box-shadow .2s;
}
.nav-float-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(0, 0, 0, .14);
}
.nav-float-label {
  display: none;
}

.nav-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.nav-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  width: 320px;
  height: 100vh;
  background: var(--surface);
  border-left: var(--border-width) solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
}
.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: var(--border-width) solid var(--border);
  flex-shrink: 0;
}
.nav-drawer-title {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--fg), var(--muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background .15s;
}
.nav-drawer-close:hover { background: var(--bg); }

.nav-drawer-roles {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: var(--border-width) solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.nav-role-btn {
  padding: 6px 12px;
  border: var(--border-width) solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--fg);
  transition: all .15s;
  font-family: var(--font-body);
}
.nav-role-btn:hover { border-color: var(--fg); background: var(--bg); }
.nav-role-btn.active { background: var(--fg); color: #ffffff; border-color: var(--fg); }

.nav-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.nav-group {
  padding: 0;
  margin-bottom: 4px;
}
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  opacity: .6;
  padding: 12px 20px 6px;
}
.nav-page-link {
  display: block;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s;
  border-left: 3px solid transparent;
}
.nav-page-link:hover { background: var(--bg); }
.nav-page-link.active {
  background: var(--border);
  font-weight: 600;
  border-left-color: var(--fg);
}

.nav-field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.7;
  padding: 14px 20px 6px;
}

.nav-drawer-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px 1px;
  border-bottom: var(--border-width) solid var(--border);
}

.nav-drawer-tab {
  flex: 1;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  font-family: var(--font-body);
  margin-bottom: -1px;
}
.nav-drawer-tab:hover { color: var(--fg); }
.nav-drawer-tab.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

.nav-group-pages {
  display: none;
  padding: 4px 0;
}
.nav-group-pages.visible {
  display: block;
}

/* ===== Public Landing Page Components ===== */
.public-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--border-width) solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 40px;
  gap: 32px;
}
.public-nav-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.public-nav-brand img {
  display: block;
  height: 32px;
  width: auto;
}
.public-nav-links {
  display: flex;
  gap: 24px;
  flex: 1;
}
.public-nav-links a {
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.public-nav-links a:hover { color: var(--muted); }
.public-nav-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.public-nav-right-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.public-nav-right-group .public-nav-actions {
  margin-left: 0;
}

.public-nav-inner {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

.public-nav-segmented .public-nav-links {
  gap: 4px;
}
.public-nav-segmented .public-nav-links a {
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 13px;
  transition: background .15s, color .15s;
}
.public-nav-segmented .public-nav-links a:hover {
  background: var(--bg);
  color: var(--fg);
}
.public-nav-segmented .public-nav-links a.active {
  background: var(--fg);
  color: #ffffff;
}

.public-nav-dropdown {
  position: relative;
}
.public-nav-dropdown > a {
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 13px;
  transition: background .15s, color .15s;
  text-decoration: none;
  color: var(--fg);
  cursor: default;
  display: inline-block;
}
.public-nav-dropdown > a:hover,
.public-nav-dropdown > a.drop-active {
  background: var(--bg);
  color: var(--fg);
}
.public-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 4px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, visibility .15s, transform .15s;
  z-index: 200;
}
.public-nav-dropdown:hover .public-nav-dropdown-menu,
.public-nav-dropdown:focus-within .public-nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.public-nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s;
}
.public-nav-dropdown-menu a:hover {
  background: var(--bg);
}
.public-nav-dropdown-menu a.nav-sub-active {
  font-weight: 600;
  background: var(--border);
}

.hero-section {
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(160deg, var(--fg) 0%, var(--muted) 60%, var(--accent) 100%);
  color: #ffffff;
  padding: 120px 32px 80px;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(6, 182, 212, .18) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(124, 58, 237, .2) 0%, transparent 60%);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}
.hero-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1.25;
  margin-bottom: 16px;
}
.hero-subtitle {
  font-size: clamp(15px, 2vw, 18px);
  opacity: .85;
  line-height: 1.7;
  margin-bottom: 32px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero .btn-primary {
  border-color: rgba(255,255,255,.2);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.hero .btn-ghost {
  color: #ffffff;
  border-color: rgba(255,255,255,.35);
}
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }

.public-section {
  padding: 72px 40px;
  max-width: 1320px;
  margin: 0 auto;
}
.public-section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.public-section-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 40px;
  color: var(--fg);
}

.func-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.func-card {
  padding: 28px 24px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow .2s, transform .2s;
}
.func-card:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, .08);
  transform: translateY(-2px);
}
.func-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.func-card-icon svg { width: 24px; height: 24px; color: var(--fg); }
.func-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.func-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.stats-strip .stat-item {
  padding: 24px 16px;
  border-right: var(--border-width) solid var(--border);
}
.stats-strip .stat-item:last-child { border-right: none; }
.stats-num {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--fg);
  line-height: 1.1;
}
.stats-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.entry-section {
  background: var(--bg);
}
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 720px;
  margin: 0 auto;
}
.entry-card {
  padding: 32px 28px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  color: var(--fg);
  transition: box-shadow .2s, transform .2s;
}
.entry-card:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, .08);
  transform: translateY(-2px);
}
.entry-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}
.entry-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.clients-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}
.client-card {
  padding: 24px 16px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
}
.client-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.client-card p {
  font-size: 12px;
  color: var(--muted);
}

.public-footer {
  background: var(--surface);
  border-top: var(--border-width) solid var(--border);
  padding: 40px;
  text-align: center;
}
.public-footer-links {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.public-footer-links a {
  font-size: 13px;
  color: var(--fg);
  text-decoration: none;
}
.public-footer-links a:hover { color: var(--muted); }
.public-footer-copy {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .public-nav {
    padding: 0 16px;
    gap: 16px;
  }
  .public-nav-links { display: none; }
  .hero-section { padding: 100px 20px 60px; }
  .public-section { padding: 48px 20px; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stats-strip .stat-item:nth-child(2n) { border-right: none; }
  .stats-strip .stat-item { border-bottom: var(--border-width) solid var(--border); }
  .clients-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-grid { grid-template-columns: 1fr; }
  .nav-drawer { width: 280px; }
  .afu-chat-dialog { width: 340px; }
}

@media (max-width: 500px) {
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .clients-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== A-Fu AI Chat Dialog ===== */
.afu-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, .25);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.afu-chat-overlay.open {
  opacity: 1;
  visibility: visible;
}

.afu-chat-dialog {
  position: fixed;
  bottom: 20px;
  right: 104px;
  z-index: 1001;
  width: 420px;
  height: 560px;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(37, 99, 235, .15);
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(.95);
  opacity: 0;
  visibility: hidden;
  transition: transform .3s ease, opacity .3s ease, visibility .3s;
}
.afu-chat-dialog.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.afu-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: var(--border-width) solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--fg), var(--muted));
  border-radius: 16px 16px 0 0;
  color: #ffffff;
}
.afu-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.afu-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.afu-chat-title {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-display);
}
.afu-chat-subtitle {
  font-size: 11px;
  opacity: .75;
}
.afu-chat-close {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, .15);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.afu-chat-close:hover { background: rgba(255, 255, 255, .25); }

.afu-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.afu-chat-welcome {
  text-align: center;
  padding: 24px 8px 8px;
}
.afu-welcome-avatar {
  margin-bottom: 12px;
}
.afu-welcome-text {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--fg);
  margin-bottom: 4px;
}
.afu-welcome-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.afu-skill-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.afu-skill-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font-body);
}
.afu-skill-block:hover {
  border-color: var(--fg);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .08);
}
.afu-skill-icon { font-size: 18px; line-height: 1; }
.afu-skill-label {
  font-size: 10px;
  color: var(--fg);
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}

.afu-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.afu-msg {
  display: flex;
  max-width: 88%;
}
.afu-msg-user {
  align-self: flex-end;
}
.afu-msg-bot {
  align-self: flex-start;
}
.afu-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.afu-msg-user .afu-msg-bubble {
  background: var(--fg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.afu-msg-bot .afu-msg-bubble {
  background: var(--bg);
  color: var(--fg);
  border: var(--border-width) solid var(--border);
  border-bottom-left-radius: 4px;
}

.afu-chat-footer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: var(--border-width) solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.afu-chat-toggles {
  display: flex;
  gap: 6px;
}
.afu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  border: var(--border-width) solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.afu-toggle:hover { border-color: var(--fg); color: var(--fg); }
.afu-toggle.active {
  background: var(--fg);
  color: #ffffff;
  border-color: var(--fg);
}
.afu-toggle svg { flex-shrink: 0; }

.afu-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.afu-chat-input {
  flex: 1;
  height: 36px;
  padding: 0 14px;
  border: var(--border-width) solid var(--border);
  border-radius: 18px;
  background: var(--bg);
  font-size: 13px;
  outline: none;
  font-family: var(--font-body);
}
.afu-chat-input:focus { border-color: var(--fg); }
.afu-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--fg);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
.afu-chat-send:hover { opacity: .85; }

/* ===== Topnav 问阿福 Bubble ===== */
.public-nav-afu {
  flex-shrink: 0;
}
.afu-nav-bubble {
  display: flex; align-items: center;
  height: 36px;
  border: var(--border-width) solid var(--border);
  border-radius: 20px; background: var(--bg);
  padding: 0 3px; gap: 3px;
  transition: border-color .3s, background .3s, min-width .3s, padding .3s, border-width .2s;
  overflow: hidden; cursor: pointer; position: relative;
}
.afu-nav-label {
  font-size: 12px; font-weight: 500; color: var(--muted);
  white-space: nowrap; padding: 0 10px 0 5px; user-select: none;
}
.afu-nav-input {
  display: none; border: none; background: transparent;
  font-size: 13px; outline: none; height: 100%;
  padding: 0; min-width: 0; font-family: var(--font-body); color: var(--fg);
}
.afu-nav-input::placeholder { color: var(--muted); opacity: .5; }
.afu-nav-search-toggle {
  display: none; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--muted);
  cursor: pointer; white-space: nowrap; padding: 0 4px; user-select: none; flex-shrink: 0;
}
.afu-nav-search-toggle input[type="checkbox"] { margin: 0; accent-color: var(--fg); }
.afu-nav-fullscreen-btn {
  display: none; width: 28px; height: 28px;
  align-items: center; justify-content: center;
  border-radius: var(--radius); border: none; background: transparent;
  cursor: pointer; color: var(--muted); flex-shrink: 0; transition: background .15s;
}
.afu-nav-fullscreen-btn:hover { background: var(--border); }
.afu-nav-send-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .15s;
}
.afu-nav-send-btn:hover { transform: scale(1.12); }

.afu-nav-bubble.expanded {
  min-width: 420px; padding: 0 5px 0 0; cursor: default;
  border: 2px solid transparent; background: var(--surface);
  background-clip: padding-box;
}
.afu-nav-bubble.expanded::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, var(--fg) 0%, var(--muted) 30%, var(--accent) 55%, var(--success) 80%, var(--fg) 100%);
  background-size: 300% 300%;
  animation: afuBorderFlow 2.4s ease infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
}
@keyframes afuBorderFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.afu-nav-bubble.expanded .afu-nav-label { display: none; }
.afu-nav-bubble.expanded .afu-nav-input { display: block; flex: 1; padding: 0 12px; }
.afu-nav-bubble.expanded .afu-nav-search-toggle { display: inline-flex; }
.afu-nav-bubble.expanded .afu-nav-fullscreen-btn { display: flex; }

@media (max-width: 768px) {
  .public-nav-afu { display: none; }
}
