/* 美德家庭辦公室：響應式樣式（手機／平板／電腦），字級偏大、按鈕易點 */
:root {
  --navy: #1F2F4D;
  --navy-d: #16223a;
  --gold: #B08D4A;
  --gold-l: #e9dcc0;
  --cream: #F7F3EA;
  --ink: #2B2B2B;
  --muted: #6b6b6b;
  --line: #ddd5c4;
  --white: #fff;
  --ok: #2e6b3f;
  --ok-bg: #e6f2e9;
  --err: #a12a2a;
  --err-bg: #fbeaea;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 18px/1.6 "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--navy); }
h1, h2 { line-height: 1.3; }
.muted { color: var(--muted); }

/* ---------- 表單 ---------- */
.field { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
label .en { font-weight: 400; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink);
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hint { font-size: .85em; color: var(--muted); margin-top: 4px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 112px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 38px; padding: 4px 12px; font: inherit; font-size: .8em;
  border: 1px solid var(--line); border-radius: 8px; background: var(--cream); color: var(--navy); cursor: pointer;
}
.pw-toggle .s-hide, .pw-toggle.on .s-show { display: none; }
.pw-toggle.on .s-hide { display: inline; }
.btn {
  display: inline-block; min-height: 50px; padding: 10px 24px; font: inherit; font-weight: 600;
  border: 1.5px solid var(--navy); border-radius: 10px; background: var(--white); color: var(--navy);
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-d); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.5); color: var(--white); min-height: 40px; padding: 4px 14px; }
.btn-block { display: block; width: 100%; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .95em; }
.alert-error { background: var(--err-bg); color: var(--err); border: 1px solid #e7bcbc; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b9dcc2; }

/* ---------- 雙語（登入類頁面） ---------- */
.auth .zh { font-weight: inherit; }
.auth .en { font-size: .85em; color: var(--muted); margin-left: .35em; }
.auth .muted .en { display: block; margin: 2px 0 0; }
.auth .alert .en { display: block; margin: 2px 0 0; color: inherit; opacity: .85; }
.auth .btn .en { color: inherit; opacity: .85; }
.auth .page-title .en { display: block; margin: 0; }

/* ---------- 登入卡片 ---------- */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 16px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--white); border-radius: 18px;
  padding: 28px 24px; box-shadow: 0 8px 30px rgba(31,47,77,.12); border-top: 6px solid var(--gold);
}
.brand { text-align: center; margin-bottom: 18px; }
.brand img { display: block; margin: 0 auto 8px; }
.brand h1 { margin: 0; font-size: 1.5rem; color: var(--navy); letter-spacing: .08em; }
.brand-en { margin: 2px 0 0; color: var(--gold); font-style: italic; font-size: 1.05rem; }
.page-title { text-align: center; font-size: 1.25rem; margin: 0 0 12px; color: var(--navy); }
.auth-links { text-align: center; margin: 18px 0 0; }
.auth-links a { display: inline-block; padding: 8px 4px; }

/* ---------- 主畫面 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 8px 16px; background: var(--navy); color: var(--white);
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 700; letter-spacing: .06em; }
.logo img { border-radius: 9px; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { color: var(--gold-l); text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.topnav a:hover { background: rgba(255,255,255,.1); color: var(--white); }
.topright { display: flex; align-items: center; gap: 10px; }
.topright form { margin: 0; }
.lang-switch { display: flex; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; overflow: hidden; }
.lang-switch button { font: inherit; font-size: .85em; min-height: 40px; min-width: 52px; padding: 0 10px; border: 0; background: transparent; color: var(--gold-l); cursor: pointer; }
.lang-switch button.on { background: var(--gold); color: var(--navy-d); font-weight: 700; }

.container { max-width: 1100px; margin: 0 auto; padding: 22px 16px 48px; }
.page-h1 { margin: 6px 0 2px; font-size: 1.6rem; color: var(--navy); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 18px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--navy); }
.card p { margin: 0 0 10px; color: var(--muted); font-size: .95em; }
.card-disabled { opacity: .75; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--gold-l); color: #6a5426; font-size: .8em; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 18px; }
.panel h2 { margin-top: 0; font-size: 1.15rem; }
.narrow { max-width: 460px; }
.kv { display: grid; grid-template-columns: 8em 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- 響應式 ---------- */
@media (max-width: 640px) {
  body { font-size: 17px; }
  .topnav { order: 3; flex-basis: 100%; }
  .topright { margin-left: auto; }
  .logo span { font-size: .95rem; }
  .auth-card { padding: 22px 18px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .pw-toggle { transition: background .15s; }
}

/* ---------- 第二階段：表格、表單格線、工具列 ---------- */
select, input[type=search] {
  min-height: 50px; padding: 10px 14px; font: inherit; width: 100%;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink);
}
.grid2 { display: grid; gap: 0 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid2 .span2 { grid-column: 1 / -1; }
.req { color: var(--err); }
.field-error { color: var(--err); font-size: .88em; margin-top: 4px; }
.has-error input, .has-error select { border-color: var(--err); }
.phone-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.static { min-height: 50px; display: flex; align-items: center; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; align-items: center; }
.toolbar input[type=search] { flex: 1 1 220px; width: auto; }
.toolbar select { flex: 0 1 200px; width: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }
.pager { display: flex; gap: 10px; }
.table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: var(--gold-l); color: #4d3d17; font-size: .9em; white-space: nowrap; }
.table th a { color: inherit; text-decoration: none; }
.table tbody tr:hover { background: #fbf8f0; }
.sub { color: var(--muted); font-size: .85em; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(31,47,77,.1); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: #eee; color: #666; }
code.secret { font-size: 1.3em; padding: 6px 12px; background: var(--cream); border: 1px dashed var(--gold); border-radius: 8px; user-select: all; }
.page-h1 small { font-size: .6em; font-weight: 400; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards { border: 0; background: transparent; }
  .table-cards tr { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; padding: 6px 4px; }
  .table-cards td { border: 0; padding: 6px 12px; display: flex; gap: 12px; }
  .table-cards td::before { content: attr(data-label); flex: 0 0 7.5em; color: var(--muted); font-size: .85em; padding-top: 2px; }
}

/* ---------- 第三階段：文件庫 ---------- */
textarea { width: 100%; padding: 10px 14px; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); }
input[type=date], input[type=number], input[type=file] { font: inherit; min-height: 46px; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--white); max-width: 100%; }
input.num { width: 90px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.btn-danger { border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: .6; cursor: wait; }
.search-bar input[type=search] { font-size: 1.1rem; }
.filters { flex-basis: 100%; }
.filters summary { cursor: pointer; padding: 6px 0; color: var(--navy); }
.filter-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.filter-grid select { width: auto; min-width: 180px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.sortbar { margin: 8px 0; font-size: .92em; }
.sortbar a { margin-right: 12px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.doc-item { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.doc-title { font-size: 1.1rem; font-weight: 700; color: var(--navy); text-decoration: none; }
.doc-title:hover { text-decoration: underline; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 4px; font-size: .92em; }
.doc-tags { margin-top: 6px; }
.tag { display: inline-block; padding: 1px 10px; margin: 2px 6px 2px 0; border-radius: 99px; border: 1px solid var(--gold); color: #6a5426; font-size: .82em; }
.snippet { margin: 8px 0 0; padding: 8px 12px; background: var(--cream); border-left: 4px solid var(--gold); border-radius: 6px; color: #444; font-size: .94em; word-break: break-word; }
mark { background: #ffe58a; color: inherit; padding: 0 2px; border-radius: 3px; }
.dropzone { border: 2px dashed var(--gold); border-radius: var(--radius); padding: 24px 16px; text-align: center; background: #fffdf7; }
.dropzone.over { background: var(--gold-l); }
.dropzone p { margin: 4px 0; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; text-align: left; font-size: .92em; }
.file-list li { padding: 4px 0; border-top: 1px solid var(--line); word-break: break-all; }
.preview-frame { width: 100%; height: 75vh; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview-img { max-width: 100%; height: auto; border-radius: 8px; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result { padding: 10px 0; border-bottom: 1px solid var(--line); word-break: break-all; }
.version-form h3 { margin: 18px 0 8px; font-size: 1rem; }
.cat-table input[type=text] { min-height: 42px; }
.cat-table select { min-height: 42px; }
/* ---------- 第四階段：會議、工作、行事曆 ---------- */
.topsearch { flex: 1 1 160px; max-width: 280px; margin: 0; }
.topsearch input { min-height: 40px; padding: 6px 12px; border-radius: 20px; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; font-size: .9rem; }
.topsearch input::placeholder { color: var(--gold-l); }
.topnav { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.btn-sm { min-height: 38px; padding: 4px 14px; font-size: .9rem; }
.prose { white-space: pre-wrap; word-break: break-word; }
.other-lang { margin-top: 10px; }
.other-lang summary { cursor: pointer; color: var(--navy); }
.plain-list { margin: 0 0 10px; padding-left: 1.2em; }
.plain-list li { margin: 6px 0; }
.inline-form { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0 4px; font: inherit; color: var(--err); text-decoration: underline; cursor: pointer; }
.attendee-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 260px; overflow: auto; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--white); margin-bottom: 14px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; min-height: 36px; }
label.check input { width: 20px; height: 20px; }
.overdue { color: var(--err); font-weight: 700; }
.small { font-size: .85em; }

.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { margin: 0 0 0 8px; font-size: 1.35rem; color: var(--navy); }
.view-tabs { display: flex; border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; }
.view-tabs a { padding: 6px 16px; text-decoration: none; color: var(--navy); min-height: 38px; display: flex; align-items: center; }
.view-tabs a.on { background: var(--navy); color: #fff; }
.cal-filter .legend { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ev { display: block; padding: 1px 6px; border-radius: 5px; font-size: .82rem; line-height: 1.35; text-decoration: none; color: #fff; background: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.ev-time { opacity: .85; }
.ev-meeting { background: var(--navy); }
.ev-meeting.ev-m-cancelled, .ev-done { text-decoration: line-through; opacity: .55; }
.ev-meeting.ev-m-planned { background: #3b5a8f; }
.ev-task { background: #e9dcc0; color: #4d3d17; }
.ev-milestone { background: var(--gold); color: #fff; font-weight: 700; }
.ev-sub { opacity: .8; }
.legend .ev { display: inline-block; margin: 0; }
.cal-month { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow div { padding: 8px; text-align: center; background: var(--gold-l); font-weight: 600; font-size: .9rem; }
.cal-cell { min-height: 112px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; position: relative; min-width: 0; }
.cal-row .cal-cell:first-child { border-left: 0; }
.cal-cell.out { background: #faf7f0; color: var(--muted); }
.cal-cell.today { background: #fff8e1; }
.cal-daynum { display: inline-block; min-width: 26px; text-align: center; padding: 1px 4px; border-radius: 13px; text-decoration: none; color: inherit; font-size: .9rem; }
.cal-cell.today .cal-daynum { background: var(--navy); color: #fff; }
.cal-dots { display: none; }
.more { font-size: .78rem; color: var(--navy); text-decoration: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--navy); margin: 0 1px; }
.dot.ev-task { background: var(--gold); }
.dot.ev-milestone { background: #8a6a2c; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-wcol { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 160px; min-width: 0; }
.cal-wcol.today { border-color: var(--gold); background: #fff8e1; }
.cal-wcol .ev { white-space: normal; }
.cal-whead { display: block; margin-bottom: 6px; color: var(--navy); text-decoration: none; }
.day-ev .ev { font-size: .95rem; padding: 6px 10px; white-space: normal; }
.cal-year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mini-month { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.mini-title { font-weight: 700; color: var(--navy); text-decoration: none; display: block; margin-bottom: 4px; }
.mini-month table { width: 100%; border-collapse: collapse; text-align: center; font-size: .8rem; }
.mini-month th { color: var(--muted); font-weight: 400; }
.mini-month td a { display: block; padding: 3px 0; text-decoration: none; color: inherit; border-radius: 50%; }
.mini-month td a.has { background: var(--gold-l); font-weight: 700; color: #4d3d17; }
.mini-month td a.today { background: var(--navy); color: #fff; }
.cal-agenda { display: grid; gap: 10px; }
.agenda-day { display: grid; grid-template-columns: 150px 1fr; gap: 12px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.agenda-day.today { border-color: var(--gold); }
.agenda-date { font-weight: 700; text-decoration: none; color: var(--navy); }

@media (max-width: 900px) {
  .cal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-week { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cal-cell { min-height: 54px; }
  .cal-cell .cal-events { display: none; }
  .cal-cell .cal-dots { display: block; text-align: center; }
  .agenda-day { grid-template-columns: 1fr; }
  .topsearch { order: 4; flex-basis: 100%; max-width: none; }
  .cal-title { font-size: 1.1rem; }
}
@media print {
  .topbar, .no-print, .toolbar { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .panel { border: 0; padding: 0; margin-top: 10px; }
  .container { max-width: none; padding: 0; }
}

/* ---------- 第七階段 A：成員類別專屬欄位 ---------- */
[hidden] { display: none !important; }
fieldset.type-block { border: 1.5px solid var(--gold); border-radius: var(--radius); padding: 10px 16px 4px; margin: 6px 0 18px; background: #fffdf7; }
fieldset.type-block legend { padding: 0 8px; font-weight: 700; color: var(--navy); }
.row-ended td { opacity: .6; }
.badge-warn { background: #fff0c9; color: #7a5200; }
.danger-zone { border-color: #e7bcbc; }
.danger-zone h2 { color: var(--err); }

/* ---------- 第七階段 B：組織圖 ---------- */
.orgchart { display: flex; flex-direction: column; align-items: center; margin: 18px 0 8px; --line: #8a8a8a; }
.oc-box { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); padding: 12px 14px; border-radius: 12px; border: 2px solid; background: #fff; text-align: center; min-width: 0; }
.oc-box:hover { box-shadow: 0 4px 14px rgba(31,47,77,.18); }
.oc-name { font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.oc-name small { font-weight: 400; color: var(--muted); }
.oc-desc { font-size: .8rem; color: var(--muted); }
.oc-people { font-size: .9rem; margin-top: 2px; }
.oc-board { background: #dbe7f7; border-color: #3b6bb0; width: min(380px, 100%); }
.oc-committee { background: #e3f1e0; border-color: #4a9a58; width: 100%; }
.oc-ceo { background: #fdebd5; border: 3px solid #d9822b; width: min(300px, 100%); }
.oc-foundation { background: #fff7e0; border-color: var(--gold); width: 100%; }
.oc-other { border-color: var(--line); }
.oc-top { display: flex; align-items: center; justify-content: center; gap: 0; width: 100%; flex-wrap: wrap; }
.oc-link { position: relative; width: 120px; height: 2px; background: var(--line); margin: 0 4px; }
.oc-link span { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 110px; text-align: center; font-size: .72rem; color: #b3261e; line-height: 1.2; }
.oc-stem { width: 2px; height: 26px; background: var(--line); }
.oc-label { font-size: .78rem; color: #b3261e; margin: -2px 0 2px; }
.oc-row { display: flex; width: 100%; gap: 16px; position: relative; padding-top: 24px; }
.oc-row::before { content: ""; position: absolute; top: 0; left: calc(100% / (var(--n) * 2)); right: calc(100% / (var(--n) * 2)); height: 2px; background: var(--line); }
.oc-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.oc-col::before { content: ""; position: absolute; top: -24px; left: 50%; width: 2px; height: 24px; background: var(--line); }
.oc-sub { width: 100%; margin-top: 12px; position: relative; }
.oc-sub::before { content: ""; position: absolute; top: -12px; left: 50%; width: 2px; height: 12px; background: var(--line); }
.oc-legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 18px; font-size: .85rem; color: var(--muted); }
.lg { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.lg-board { background: #3b6bb0; } .lg-committee { background: #4a9a58; } .lg-ceo { background: #d9822b; }
.warn-panel { border-color: #f0d9a0; background: #fffaf0; }
@media (max-width: 860px) {
  .oc-top { flex-direction: column; gap: 10px; }
  .oc-link, .oc-stem, .oc-label, .oc-row::before, .oc-col::before, .oc-sub::before { display: none; }
  .oc-row { flex-direction: column; padding-top: 12px; }
  .oc-col { width: 100%; }
}

/* ---------- 第七階段 C：家族樹 ---------- */
.ft-scroll { overflow-x: auto; padding: 8px 0 18px; }
.ft { display: inline-flex; flex-direction: column; min-width: 100%; align-items: center; --fl: #8a8a8a; }
.ft ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 22px 0 0; position: relative; }
.ft > ul { padding-top: 0; }
.ft li { position: relative; padding: 22px 10px 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.ft > ul > li { padding-top: 0; }
.ft li::before, .ft li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid var(--fl); }
.ft li::after { right: auto; left: 50%; border-left: 2px solid var(--fl); }
.ft > ul > li::before, .ft > ul > li::after { display: none; }
.ft li:only-child::before, .ft li:only-child::after { display: none; }
.ft li:only-child { padding-top: 22px; }
.ft li:first-child::before, .ft li:last-child::after { border: 0 none; }
.ft li:last-child::before { border-right: 2px solid var(--fl); border-radius: 0 8px 0 0; }
.ft li:first-child::after { border-radius: 8px 0 0 0; }
.ft ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 2px solid var(--fl); }
.ft-unit { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ft-gen { font-size: .72rem; color: var(--muted); }
.ft-couple { display: flex; align-items: center; gap: 4px; }
.ft-join { color: var(--gold); font-size: 1.2rem; }
.ft-card { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 150px; min-height: 104px; padding: 8px 8px; border-radius: 12px; border: 2px solid #c9c2b0; background: #fff; text-decoration: none; color: var(--ink); }
.ft-card:hover { box-shadow: 0 4px 14px rgba(31,47,77,.18); }
.ft-card.g-m { border-color: #5b8fd0; background: #eef5fd; }
.ft-card.g-f { border-color: #d77fa3; background: #fdf0f5; }
.ft-name { font-weight: 700; color: var(--navy); }
.ft-star { color: var(--gold); }
.ft-en { font-size: .78rem; color: var(--muted); }
.ft-rel { font-size: .85rem; }
.ft-meta { font-size: .75rem; color: var(--muted); word-break: break-word; }
.ft-gone { opacity: .6; filter: grayscale(.7); }
.ft-gone-tag { font-size: .72rem; color: var(--muted); }
.ft-note { font-size: .75rem; color: var(--muted); }
.ft-tools { display: flex; gap: 10px; font-size: .78rem; }
.lg-m { background: #5b8fd0; } .lg-f { background: #d77fa3; } .lg-x { background: #c9c2b0; }

/* ---------- 第七階段 D：官方網站 ---------- */
.topnav a.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 700; }
.subnav { display: flex; gap: 4px; padding: 6px 16px; background: #2b3f66; overflow-x: auto; white-space: nowrap; }
.subnav a { color: var(--gold-l); text-decoration: none; padding: 6px 14px; border-radius: 8px; font-size: .95rem; }
.subnav a:hover { background: rgba(255,255,255,.1); }
.subnav a.on { background: var(--gold); color: var(--navy-d); font-weight: 700; }
.big { font-size: 2rem; font-weight: 700; color: var(--navy); margin: 0; }
.hero { display: flex; gap: 22px; align-items: center; padding: 26px 24px; border-radius: 18px; background: linear-gradient(135deg, #1F2F4D 0%, #2b3f66 100%); color: #fff; margin-bottom: 14px; }
.hero-logo { border-radius: 20px; flex: none; background: #fffbef; }
.hero h1 { margin: 0; font-size: 2rem; letter-spacing: .08em; }
.hero-en { margin: 2px 0 10px; color: var(--gold-l); font-style: italic; font-size: 1.05rem; }
.hero-text { color: #eef1f7; font-size: 1.05rem; max-width: 52em; }
.hero-text p { margin: 0 0 8px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.hero .btn { border-color: var(--gold); color: var(--gold-l); background: transparent; }
.hero .btn-primary { background: var(--gold); color: var(--navy-d); }
.hero-edit { color: var(--gold-l); font-size: .85rem; margin-left: 6px; }
.site-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 4px; }
.site-card { margin-top: 0; }
.site-card h2 a { color: var(--navy); text-decoration: none; }
.progress { height: 12px; background: #eee6d2; border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #e0bf74); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .85rem; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.gs-pending.on { background: #8a8a8a; border-color: #8a8a8a; }
.chip.gs-draft.on { background: #c98a1b; border-color: #c98a1b; }
.chip.gs-reviewing.on { background: #7a5cb0; border-color: #7a5cb0; }
.chip.gs-awaiting.on { background: #3b6bb0; border-color: #3b6bb0; }
.chip.gs-approved.on { background: #2e6b3f; border-color: #2e6b3f; }
.chip.gs-superseded.on { background: #a12a2a; border-color: #a12a2a; }
.page-article { max-width: 780px; }
.page-article.has-photo::after { content: ""; display: block; clear: both; }
.page-photo { float: right; width: 260px; max-width: 42%; margin: 0 0 12px 22px; border-radius: 14px; border: 3px solid var(--gold-l); box-shadow: 0 6px 20px rgba(31,47,77,.15); }
.page-photo-thumb { max-width: 220px; border-radius: 10px; border: 1px solid var(--line); }
.prose-rich { font-size: 1.08rem; line-height: 1.95; }
.prose-rich p { margin: 0 0 1em; }
.prose-rich h2, .prose-rich h3 { color: var(--navy); margin: 1.4em 0 .5em; }
.prose-rich ul { padding-left: 1.4em; }
.prose-rich li { margin: .25em 0; }
@media (max-width: 640px) {
  .hero { flex-direction: column; text-align: center; padding: 20px 16px; }
  .hero-links { justify-content: center; }
  .page-photo { float: none; display: block; margin: 0 auto 14px; max-width: 70%; width: 260px; }
}

/* 導覽列項目變多：縮小間距、搜尋框變窄，讓桌面寬度下不必捲動 */
.topnav { gap: 0; }
.topnav a { padding: 8px 9px; font-size: .97rem; }
.topsearch { flex: 0 1 190px; max-width: 190px; }
@media (max-width: 640px) { .topsearch { max-width: none; flex-basis: 100%; } .topnav a { padding: 8px 10px; } }

/* ---------- 第七階段 E：文件管制、列印浮水印 ---------- */
.badge-code { background: #e8eefb; color: #1F2F4D; font-weight: 700; letter-spacing: .02em; }
.badge.ds-draft { background: #fff0c9; color: #7a5200; }
.badge.ds-effective { background: var(--ok-bg); color: var(--ok); }
.badge.ds-superseded { background: #f3dede; color: #8a1f1f; text-decoration: line-through; }
.panel-details { border: 1.5px dashed var(--gold); border-radius: var(--radius); padding: 8px 14px 4px; margin: 10px 0 18px; background: #fffdf7; }
.panel-details > summary { cursor: pointer; font-weight: 700; color: var(--navy); padding: 6px 0; }
.inline-pick { display: inline-flex; gap: 6px; align-items: center; }
.inline-pick select { min-height: 42px; width: auto; }
.ctl-kv { margin: 6px 0 4px; }
.print-wm, .print-foot { display: none; }
@media print {
  .print-wm { display: block; position: fixed; top: 38%; left: -5%; width: 110%; text-align: center; transform: rotate(-28deg);
              font-size: 2.6rem; font-weight: 700; color: rgba(60,60,60,.14); z-index: 9999; pointer-events: none; }
  .print-foot { display: block; position: fixed; bottom: 6px; left: 12px; font-size: 9pt; color: #555; z-index: 9999; }
}

/* ---------- 8B：組織分頁列與組織圖 v2 ---------- */
.hubtabs { display: flex; gap: 6px; margin: 4px 0 14px; overflow-x: auto; border-bottom: 2px solid var(--line); }
.hubtabs a { padding: 10px 18px; font-size: 1.05rem; text-decoration: none; color: var(--ink); border-radius: 10px 10px 0 0; white-space: nowrap; }
.hubtabs a:hover { background: #eef2f8; }
.hubtabs a.on { background: var(--navy); color: #fff; font-weight: 700; }
.oc2 { --line: #8a8a8a; max-width: 1040px; margin: 8px auto 0; }
.oc2-title { margin: 0 0 4px; font-size: 1.7rem; color: var(--navy-d); }
.oc2-rule { height: 3px; background: #e08a2e; margin: 0 0 22px; border: 0; }
.oc2-board { display: flex; justify-content: center; }
.oc2-board .oc-box { width: min(420px, 100%); text-align: center; }
.oc2-mid { position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: 120px; }
.oc2-mid::before { content: ""; position: absolute; left: 50%; top: 0; bottom: -26px; width: 2px; background: var(--line); transform: translateX(-1px); }
.oc2-right { grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; padding-top: 22px; }
.oc2-ceo-row { display: flex; align-items: center; width: 100%; }
.oc2-branch { position: relative; flex: 1 1 auto; height: 2px; background: var(--line); min-width: 40px; }
.oc2-branch span { position: absolute; top: 6px; left: 8px; white-space: nowrap; font-size: .8rem; color: #b3261e; font-weight: 600; }
.oc2-right .oc-ceo { width: min(300px, 62%); flex: 0 0 auto; text-align: center; }
.oc2-ceo-note { margin-top: 6px; font-size: .8rem; color: #b3261e; font-weight: 600; text-align: center; width: min(300px, 62%); }
.oc2-row { position: relative; margin-top: 26px; }
.oc2-row .oc-label { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: #fff; padding: 0 8px; margin: 0; z-index: 1; font-weight: 600; }
.oc2 .oc-box { text-align: center; align-items: center; }
.oc-lines { display: flex; flex-direction: column; gap: 1px; font-size: .84rem; color: #444; }
.oc-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.oc-tag { font-size: .8rem; padding: 2px 10px; border-radius: 99px; background: #fff7e0; border: 1.5px solid var(--gold); color: #5a4300; text-decoration: none; }
.oc-people small { color: var(--muted); }
.oc2-note { margin-top: 18px; font-size: .85rem; color: var(--muted); font-style: italic; }
.oc2-ver { text-align: right; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.oc2-toggle { display: flex; justify-content: flex-end; gap: 8px; margin: 6px 0; }
.rosters { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 12px; }
.roster-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.roster-card ul { list-style: none; margin: 8px 0 0; padding: 0; }
.roster-card li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.roster-card li:last-child { border-bottom: 0; }
.roster-card .pos { color: var(--muted); font-size: .9rem; white-space: nowrap; }
@media (max-width: 860px) {
  .oc2-mid { display: block; min-height: 0; }
  .oc2-mid::before, .oc2-branch, .oc2-row .oc-label { display: none; }
  .oc2-right { padding-top: 10px; align-items: stretch; }
  .oc2-right .oc-ceo, .oc2-ceo-note { width: 100%; }
  .oc2-ceo-row { display: block; }
  .oc2-row { margin-top: 10px; }
}
@media print {
  .hubtabs, .oc2-toggle { display: none !important; }
  .oc2 { max-width: none; }
}
.oc2 .oc-box { position: relative; }
.oc-name a.stretched { color: inherit; text-decoration: none; }
.oc-name a.stretched::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.oc-tag { position: relative; z-index: 2; }
.oc2 .oc-col { align-items: stretch; }
.oc2 .oc-committee { flex: 1 1 auto; }
.hubtabs button { padding: 10px 18px; font-size: 1.05rem; background: none; border: 0; cursor: pointer; color: var(--ink); border-radius: 10px 10px 0 0; white-space: nowrap; font-family: inherit; }
.hubtabs button:hover { background: #eef2f8; }
.hubtabs button.on { background: var(--navy); color: #fff; font-weight: 700; }
.hubtabs button[hidden] { display: none; }
