/* =========================================================
   SCI 全人照護導航 — 共用設計系統
   Design tokens 取自 docs/design 參考稿
   ========================================================= */

:root {
  /* 主色：慈濟療癒青綠 */
  --tz-teal-900: #0A5A4D;
  --tz-teal-700: #0E7C6B;
  --tz-teal-500: #2E9C86;
  --tz-teal-300: #7FC9B7;
  --tz-teal-100: #DCF0EA;
  --tz-teal-50:  #EFF9F6;

  /* 輔色 */
  --tz-navy:  #12395A;
  --tz-navy-2:#2A5A80;
  --tz-blue:  #2E7FD4;
  --tz-sky:   #DCEBFA;

  /* 語意色 */
  --tz-ok:    #2E9C6B;
  --tz-warn:  #E8912F;
  --tz-alert: #E0556A;
  --tz-info:  #4E7BD6;

  /* 柔和底色（卡片分類用） */
  --tz-pink:  #FCE4E8;
  --tz-peach: #FDEBD8;
  --tz-mint:  #DCF0E6;
  --tz-lilac: #EAE2F8;
  --tz-lemon: #FBF1D3;
  --tz-aqua:  #DDEEF7;

  /* 中性 */
  --tz-bg:    #F1F8F6;
  --tz-card:  #FFFFFF;
  --tz-line:  #E2EDEA;
  --tz-text:  #12395A;
  --tz-muted: #6D8A93;

  --tz-r-sm: 12px;
  --tz-r:    18px;
  --tz-r-lg: 24px;
  --tz-shadow:    0 2px 10px rgba(18, 57, 90, .06);
  --tz-shadow-lg: 0 10px 30px rgba(18, 57, 90, .10);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--tz-text);
  background: var(--tz-bg);
  margin: 0;
  letter-spacing: .01em;
}

/* 手寫體：參考稿中的溫暖手寫註記 */
.tz-hand {
  font-family: "Klee One", "Noto Sans TC", cursive;
  color: var(--tz-teal-700);
  line-height: 1.7;
}

/* ---------- 卡片 ---------- */
.tz-card {
  background: var(--tz-card);
  border-radius: var(--tz-r);
  box-shadow: var(--tz-shadow);
  border: 1px solid var(--tz-line);
}
.tz-card-flat { background: var(--tz-card); border-radius: var(--tz-r); border: 1px solid var(--tz-line); }
.tz-card-hd {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--tz-line);
  font-weight: 700; color: var(--tz-navy);
}

/* ---------- 按鈕 ---------- */
.tz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  border: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-decoration: none;
}
.tz-btn:active { transform: scale(.97); }
.tz-btn-primary { background: var(--tz-teal-700); color: #fff; box-shadow: 0 6px 16px rgba(14,124,107,.25); }
.tz-btn-primary:hover { background: var(--tz-teal-900); }
.tz-btn-blue { background: var(--tz-blue); color: #fff; box-shadow: 0 6px 16px rgba(46,127,212,.25); }
.tz-btn-ghost { background: #fff; color: var(--tz-teal-700); border: 1.5px solid var(--tz-teal-300); }
.tz-btn-ghost:hover { background: var(--tz-teal-50); }
.tz-btn-sm { padding: .5rem 1rem; font-size: .875rem; }
.tz-btn-block { width: 100%; }

/* ---------- Chip / Tag ---------- */
.tz-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .75rem; border-radius: 999px;
  font-size: .8125rem; font-weight: 700;
  background: var(--tz-teal-100); color: var(--tz-teal-900);
}
.tz-chip-warn  { background: #FDF0DC; color: #A96412; }
.tz-chip-alert { background: #FCE2E6; color: #B03349; }
.tz-chip-ok    { background: #DDF2E6; color: #1E7A51; }
.tz-chip-info  { background: var(--tz-sky); color: #1F5896; }
.tz-chip-gray  { background: #EDF2F3; color: var(--tz-muted); }

/* ---------- 可選取的選項（單/複選） ---------- */
.tz-opt {
  display: flex; align-items: center; gap: .85rem;
  width: 100%; text-align: left;
  padding: .9rem 1rem;
  background: #fff; border: 1.5px solid var(--tz-line);
  border-radius: var(--tz-r-sm); cursor: pointer;
  transition: all .15s ease;
}
.tz-opt:hover { border-color: var(--tz-teal-300); background: var(--tz-teal-50); }
.tz-opt.is-on { border-color: var(--tz-teal-700); background: var(--tz-teal-50); box-shadow: 0 0 0 3px rgba(46,156,134,.12); }
.tz-opt .tz-box {
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  border: 2px solid #C9D9DA; display: grid; place-items: center;
  color: transparent; font-size: 14px; font-weight: 900; transition: all .15s;
}
.tz-opt.is-on .tz-box { background: var(--tz-teal-700); border-color: var(--tz-teal-700); color: #fff; }
.tz-opt .tz-box.is-radio { border-radius: 50%; }

/* ---------- 磚塊（大按鈕卡） ---------- */
.tz-tile {
  display: block; padding: 1rem; border-radius: var(--tz-r);
  text-decoration: none; color: var(--tz-navy);
  transition: transform .15s ease, box-shadow .15s ease;
  border: 1px solid rgba(255,255,255,.6);
}
.tz-tile:hover { transform: translateY(-3px); box-shadow: var(--tz-shadow-lg); }

/* ---------- 步驟列 ---------- */
.tz-steps { display: flex; align-items: flex-start; gap: 0; }
.tz-step { flex: 1; text-align: center; position: relative; }
.tz-step::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%;
  height: 2px; background: #D7E5E3;
}
.tz-step:first-child::before { display: none; }
.tz-step-dot {
  position: relative; z-index: 1; margin: 0 auto 6px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: #D7E5E3; color: #7D979B; font-weight: 800; font-size: .8125rem;
}
.tz-step.is-on  .tz-step-dot  { background: var(--tz-teal-700); color: #fff; box-shadow: 0 0 0 4px rgba(46,156,134,.18); }
.tz-step.is-done .tz-step-dot { background: var(--tz-teal-300); color: #fff; }
.tz-step-label { font-size: .6875rem; color: var(--tz-muted); line-height: 1.3; }
.tz-step.is-on .tz-step-label { color: var(--tz-teal-900); font-weight: 700; }

/* ---------- 手機外框 ---------- */
.tz-phone {
  width: 100%; max-width: 420px; margin: 0 auto;
  min-height: 100vh; background: #fff;
  position: relative; display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(18,57,90,.10);
}
.tz-statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 1.25rem .25rem; font-size: .8125rem; font-weight: 700;
  color: var(--tz-navy); flex: none;
}
.tz-appbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem 1rem .75rem; flex: none;
}
.tz-appbar h1 { font-size: 1.25rem; font-weight: 800; margin: 0; flex: 1; text-align: center; }
.tz-scroll { flex: 1; overflow-y: auto; padding-bottom: 5.5rem; }
.tz-tabbar {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr);
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--tz-line);
  padding: .5rem 0 max(.5rem, env(safe-area-inset-bottom));
}
.tz-tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .6875rem; color: var(--tz-muted); text-decoration: none; font-weight: 600;
}
.tz-tabbar a.is-on { color: var(--tz-teal-700); }
.tz-tabbar svg { width: 22px; height: 22px; }

/* ---------- 列表列 ---------- */
.tz-row {
  display: flex; align-items: center; gap: .85rem;
  padding: .9rem 1rem; background: #fff;
  border-radius: var(--tz-r-sm); border: 1px solid var(--tz-line);
  text-decoration: none; color: var(--tz-navy);
  transition: all .15s;
}
.tz-row:hover { border-color: var(--tz-teal-300); transform: translateX(2px); }
.tz-row-ico {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
}

/* ---------- 表格 ---------- */
.tz-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tz-table th {
  text-align: left; padding: .7rem .85rem; background: var(--tz-teal-50);
  color: var(--tz-teal-900); font-weight: 700; white-space: nowrap;
  border-bottom: 1px solid var(--tz-line);
}
.tz-table td { padding: .7rem .85rem; border-bottom: 1px solid var(--tz-line); }
.tz-table tbody tr:hover { background: var(--tz-teal-50); }

/* ---------- 後台版面 ---------- */
.tz-admin { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.tz-side {
  background: linear-gradient(180deg, #0E7C6B 0%, #0A5A4D 100%);
  color: #DCF0EA; padding: 1.25rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.tz-side a {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 1.25rem; color: #C6E6DE; text-decoration: none;
  font-size: .9rem; font-weight: 600; border-left: 3px solid transparent;
}
.tz-side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.tz-side a.is-on { background: rgba(255,255,255,.14); color: #fff; border-left-color: #A9E6D6; }
.tz-side .tz-side-grp {
  padding: 1rem 1.25rem .35rem; font-size: .6875rem; letter-spacing: .12em;
  color: rgba(220,240,234,.55); font-weight: 700;
}

/* ---------- 工作站（平板）版面 ---------- */
.tz-work { display: grid; grid-template-columns: 210px 1fr 300px; gap: 1rem; align-items: start; }
@media (max-width: 1180px) { .tz-work { grid-template-columns: 180px 1fr; } .tz-work .tz-work-aside { grid-column: 1 / -1; } }
@media (max-width: 820px)  { .tz-work { grid-template-columns: 1fr; } }

.tz-worknav a {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .85rem; margin-bottom: .5rem;
  background: #fff; border: 1px solid var(--tz-line); border-radius: var(--tz-r-sm);
  text-decoration: none; color: var(--tz-navy); font-weight: 700; font-size: .9rem;
  transition: all .15s;
}
.tz-worknav a:hover { border-color: var(--tz-teal-300); background: var(--tz-teal-50); }
.tz-worknav a.is-on { background: var(--tz-teal-700); color: #fff; border-color: var(--tz-teal-700); box-shadow: 0 6px 16px rgba(14,124,107,.22); }
.tz-worknav .n {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--tz-teal-100); color: var(--tz-teal-900); font-size: .8125rem; font-weight: 800;
}
.tz-worknav a.is-on .n { background: rgba(255,255,255,.28); color: #fff; }

/* ---------- 頁籤 ---------- */
.tz-tabs { display: flex; gap: .35rem; border-bottom: 1px solid var(--tz-line); overflow-x: auto; }
.tz-tabs button {
  padding: .6rem 1rem; border: none; background: none; cursor: pointer;
  font-weight: 700; font-size: .875rem; color: var(--tz-muted);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tz-tabs button.is-on { color: var(--tz-teal-700); border-bottom-color: var(--tz-teal-700); }

/* ---------- 輸入 ---------- */
.tz-input, .tz-select, .tz-textarea {
  width: 100%; padding: .7rem .85rem;
  border: 1.5px solid var(--tz-line); border-radius: var(--tz-r-sm);
  background: #fff; color: var(--tz-text); font-family: inherit; font-size: .9375rem;
}
.tz-input:focus, .tz-select:focus, .tz-textarea:focus {
  outline: none; border-color: var(--tz-teal-500); box-shadow: 0 0 0 3px rgba(46,156,134,.14);
}
.tz-label { display: block; font-size: .8125rem; font-weight: 700; color: var(--tz-navy); margin-bottom: .35rem; }

/* ---------- 分段控制 ---------- */
.tz-seg { display: inline-flex; background: #EDF3F3; border-radius: 999px; padding: 4px; gap: 4px; }
.tz-seg button {
  border: none; background: none; cursor: pointer; padding: .45rem 1.1rem;
  border-radius: 999px; font-weight: 700; font-size: .875rem; color: var(--tz-muted);
}
.tz-seg button.is-on { background: var(--tz-teal-700); color: #fff; }

/* ---------- 其他 ---------- */
.tz-hero {
  background: linear-gradient(135deg, var(--tz-teal-50) 0%, var(--tz-sky) 100%);
  border-radius: var(--tz-r-lg);
}
.tz-note {
  background: var(--tz-lemon); border-radius: var(--tz-r-sm);
  padding: .85rem 1rem; font-size: .875rem; color: #8A6410;
}
.tz-bar { height: 8px; border-radius: 999px; background: #E4EDEC; overflow: hidden; }
.tz-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--tz-teal-500); }

.tz-scroll::-webkit-scrollbar, .tz-side::-webkit-scrollbar { width: 6px; }
.tz-scroll::-webkit-scrollbar-thumb, .tz-side::-webkit-scrollbar-thumb { background: rgba(18,57,90,.18); border-radius: 3px; }

.tz-fade { animation: tzFade .35s ease; }
@keyframes tzFade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

@media print {
  .tz-noprint { display: none !important; }
  body { background: #fff; }
}
