/* 聖道門擇日館後台：江南水墨風格（2026-11-23 定案） */
@import url("https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@400;700&family=Noto+Sans+TC:wght@400;500;700&display=swap");

:root {
  --paper: #FAF8F0; --side: #F5F2E8; --card: #FFFFFF; --line: #E6E1D4; --line2: #EDE9DE; --wash: #F3F0E6;
  --ink: #2A2A28; --ink2: #63615B; --edge: #8B897F; --red: #A8322A; --teal: #3B5B5E;
  --kai: "LXGW WenKai TC", "DFKai-SB", "BiauKai", serif;
  --shadow: 0 6px 24px rgba(90, 88, 78, 0.07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 "Noto Sans TC", system-ui, sans-serif; }
a { color: var(--teal); }
a:hover { color: var(--red); }
h1, h2, h3 { margin: 0; }
.kai { font-family: var(--kai); }
.muted { color: var(--ink2); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.red { color: var(--red); font-weight: 700; }
.teal { color: var(--teal); font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* 版面 */
.shell { display: flex; min-height: 100vh; }
.side { flex: 0 0 220px; background: var(--side); padding: 28px 16px 0; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; text-decoration: none; color: var(--ink); }
.brand .stamp { width: 40px; height: 40px; border-radius: 5px; background: var(--red); color: var(--paper); display: flex; align-items: center; justify-content: center; font: 700 20px/1 var(--kai); }
.brand b { display: block; font: 700 24px/1.2 var(--kai); }
.brand small { font-size: 13px; color: var(--ink2); letter-spacing: 3px; }
.side a.nav { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px 0 30px; border-radius: 22px; color: var(--ink); text-decoration: none; }
.side a.nav:hover { background: #ECE8DC; }
.side a.nav[aria-current="page"] { padding-left: 12px; background: #E6E2D6; font-weight: 700; }
.side a.nav[aria-current="page"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.side .bamboo { display: block; width: 100%; height: 300px; margin-top: auto; flex-shrink: 1; min-height: 0; }
.main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.banner { position: relative; min-height: 190px; padding: 34px 40px 22px; display: flex; flex-direction: column; overflow: hidden; }
.banner svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.banner > div { position: relative; }
.banner h1 { font: 700 44px/1.2 var(--kai); letter-spacing: 4px; }
.banner .sub { font-size: 15px; color: var(--ink2); letter-spacing: 1px; margin-top: 4px; }
.banner .crumb { font-size: 15px; color: var(--ink2); margin-bottom: 2px; }
.banner .crumb a, a.pad { display: inline-flex; align-items: center; min-height: 44px; }
.banner .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; padding-top: 22px; }
.content { padding: 8px 40px 48px; display: flex; flex-direction: column; gap: 26px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.row.stretch { align-items: stretch; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.f1 { flex: 1 1 320px; } .f2 { flex: 2 1 420px; } .f3 { flex: 3 1 460px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* 元件 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.pad { padding: 20px 24px; }
.h2 { font: 700 24px/1.3 var(--kai); letter-spacing: 2px; }
.btn { font: inherit; font-weight: 700; min-height: 46px; padding: 0 22px; border-radius: 23px; border: 1px solid var(--edge); background: #FFF; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--wash); color: var(--ink); }
.btn.primary { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #45443F; color: var(--paper); }
.btn.sm { min-height: 44px; padding: 0 16px; }
.btn.link { border: 0; background: none; color: var(--teal); padding: 0 6px; font-weight: 500; text-decoration: underline; }
.btn.danger { color: var(--red); border-color: var(--red); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  font: inherit; color: var(--ink); background: #FFF; border: 1px solid var(--edge); border-radius: 10px; min-height: 46px; padding: 0 14px; width: 100%; }
textarea { padding: 10px 14px; min-height: 110px; resize: vertical; line-height: 1.6; }
input[type=search] { border-radius: 23px; padding: 0 18px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--ink); flex: 0 0 auto; }
label.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 0; }
label.field > span, .label { font-weight: 700; }
.stack > label.field, .col > label.field, .gate label.field { flex: 0 0 auto; }
label.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.opts { display: flex; flex-wrap: wrap; gap: 10px; }
.opts label { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border: 1px solid var(--edge); border-radius: 23px; background: #FFF; cursor: pointer; }
.opts label:has(input:checked) { border-color: var(--ink); font-weight: 700; background: var(--wash); }
.pill { display: inline-block; padding: 1px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; border: 1px solid var(--edge); }
.pill.red { background: var(--red); border-color: var(--red); color: #FFF; }
.pill.teal { border-color: var(--teal); color: var(--teal); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 11px; border-radius: 999px; border: 1px solid var(--teal); color: var(--teal); font-size: 14px; white-space: nowrap; }
.tag button { font: inherit; border: 0; background: none; color: var(--teal); cursor: pointer; min-width: 28px; min-height: 28px; padding: 0; }
.seal { font-size: 12px; font-weight: 700; color: var(--red); border: 1.5px solid var(--red); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.bigseal { display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; border: 2px solid var(--red); border-radius: 6px; color: var(--red); font: 700 15px/1.1 var(--kai); text-align: center; transform: rotate(-6deg); }
.chip { font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; padding: 0 16px; border-radius: 22px; background: #FFF; color: var(--ink); border: 1px solid var(--edge); text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.chip[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 9px 12px; }
.kv > :nth-child(odd) { color: var(--ink2); }
.kv > :nth-child(even) { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.pillars { display: flex; gap: 6px; flex-wrap: wrap; }
.pillar { font: 700 22px/1.5 var(--kai); padding: 0 8px; border: 1px solid #CFC9BA; border-radius: 6px; background: var(--paper); white-space: nowrap; }
.pillar.day { border: 2px solid var(--ink); }
.summary { display: flex; flex-wrap: wrap; gap: 18px 36px; align-items: center; }
.summary .k { font-size: 13px; color: var(--ink2); }
.summary .v { font-size: 20px; font-weight: 700; }
.flash { border-radius: 12px; padding: 12px 18px; background: #E8EFEC; border: 1px solid var(--teal); }
.flash.err { background: #F8E9E6; border-color: var(--red); color: #7A1F18; font-weight: 700; }
.hint { background: var(--paper); border-radius: 12px; padding: 12px 16px; font-size: 15px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a, .tabs button { font: inherit; min-height: 46px; padding: 0 16px; border: 0; background: none; color: var(--ink2); font-weight: 500; border-bottom: 3px solid transparent; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; white-space: nowrap; }
.tabs [aria-selected="true"], .tabs [aria-current="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }

/* 清單與表格 */
.list > * { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 14px 20px; border-top: 1px solid var(--line2); color: var(--ink); text-decoration: none; }
.list > *:first-child { border-top: 0; }
.list a:hover { background: var(--paper); color: var(--ink); }
.list .grow { flex: 1 1 130px; min-width: 0; }
.list .kind { flex: 0 0 76px; font-size: 14px; font-weight: 700; }
.tablebox { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; font-weight: 700; text-align: left; white-space: nowrap; background: var(--wash); }
td { padding: 12px 16px; border-top: 1px solid var(--line2); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--paper); }
td a.name { font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink2); }

/* 首頁 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; text-decoration: none; color: var(--ink); }
.tile:hover { color: var(--ink); border-color: var(--edge); }
.tile .t { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tile .n { font-size: 32px; font-weight: 700; line-height: 1.3; }
.tile .n small { font-size: 15px; font-weight: 500; }
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: end; margin-top: auto; }
.bars > div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.bars i { display: block; width: 100%; background: var(--edge); border-radius: 8px 8px 0 0; }
.bars .cur i { background: var(--ink); }
.bars .cur { font-weight: 700; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; }
.steps button { font: inherit; min-height: 46px; padding: 0 16px; border-radius: 23px; border: 1px solid var(--edge); background: #FFF; color: var(--ink); cursor: pointer; }
.steps button.done { background: var(--wash); color: var(--ink2); }
.steps button.now { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }

/* 登入頁 */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; position: relative; overflow: hidden; }
.gate svg.scene { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 46vh; min-height: 230px; pointer-events: none; }
.gate .box { position: relative; width: 100%; max-width: 420px; padding: 32px 30px; display: flex; flex-direction: column; gap: 16px; }
.gate h1 { font: 700 34px/1.2 var(--kai); letter-spacing: 4px; }

/* 手機與窄螢幕 */
@media (max-width: 860px) {
  .shell { display: block; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 10; flex-direction: row; padding: 0 4px; gap: 0; overflow-x: auto; border-top: 1px solid var(--line); }
  .side { scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side .brand, .side .bamboo { display: none; }
  .side a.nav { flex: 1 0 auto; flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: 0 12px; border-radius: 0; font-size: 14px; white-space: nowrap; }
  .side a.nav[aria-current="page"] { padding: 0 12px; background: none; }
  .side a.nav[aria-current="page"]::before { width: 7px; height: 7px; }
  .main { padding-bottom: 76px; }
  .banner { min-height: 130px; padding: 18px 16px 12px; }
  .banner svg.scene { opacity: 0.45; }
  .banner h1 { font-size: 32px; letter-spacing: 2px; }
  .banner .actions { padding-top: 14px; }
  .content { padding: 8px 16px 32px; gap: 18px; }
  .pad { padding: 16px 16px; }
  .row { gap: 16px; }
  .h2 { font-size: 21px; }
  .kv { grid-template-columns: 72px 1fr; }
  .pillar { font-size: 20px; padding: 0 6px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 12px 14px; }
  .tile .n { font-size: 26px; }
  .btn { padding: 0 16px; }
  .list > * { padding: 12px 16px; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-top: 1px solid var(--line2); padding: 10px 16px; }
  table.cards tr:first-child { border-top: 0; }
  table.cards td { border: 0; padding: 2px 0; }
  table.cards td[data-l]::before { content: attr(data-l) "　"; color: var(--ink2); font-size: 14px; }
}
@media print { .side, .banner .actions { display: none; } }
