/* =========================================================================
 * 希望種子 教育訓練管理系統 Demo — 拓學院白底學院風
 * 拓海藍 #002856 / 領航金 #CC9F53
 * ========================================================================= */

:root {
  --navy: #002856;
  --navy-soft: #1a4372;
  --gold: #CC9F53;
  --gold-soft: #e3c583;
  --ink: #1c2530;
  --muted: #6b7683;
  --line: #e4e8ee;
  --bg: #f6f8fb;
  --card: #ffffff;

  --green: #1f8a5b;  --green-bg: #e6f4ec;
  --amber: #b8801f;  --amber-bg: #fbf1dc;
  --red:   #c0392b;  --red-bg:   #fbe9e7;
  --blue:  #2563a8;  --blue-bg:  #e7f0fb;
  --gray:  #6b7683;  --gray-bg:  #eef1f5;

  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,40,86,.06);
  --shadow-lg: 0 8px 28px rgba(0,40,86,.12);
}

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

body {
  font-family: "PingFang TC", "Noto Sans TC", -apple-system, "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* 中文與英數之間留白由內容處理，這裡確保排版乾淨 */
h1,h2,h3,h4 { color: var(--navy); font-weight: 700; letter-spacing: .01em; }
a { color: var(--navy); text-decoration: none; }

/* ---- 頂部列 ---- */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 0 20px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; }
.topbar .brand .logo-badge {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--gold); color: var(--navy);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.topbar .brand small { color: var(--gold-soft); font-weight: 500; font-size: 12px; }

/* 角色切換器 */
.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch label { color: var(--gold-soft); font-size: 13px; }
.role-switch select {
  background: #fff; color: var(--navy); border: none;
  border-radius: 8px; padding: 7px 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}

/* ---- 版面 ---- */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--line);
  padding: 16px 12px; flex-shrink: 0;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--ink);
  font-size: 14.5px; cursor: pointer; margin-bottom: 3px; transition: .15s;
}
.sidebar .nav-item:hover { background: var(--bg); }
.sidebar .nav-item.active { background: var(--navy); color: #fff; font-weight: 600; }
.sidebar .nav-item .ico { font-size: 17px; width: 20px; text-align: center; }
.sidebar .nav-section { font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; margin: 14px 12px 6px; }

.main { flex: 1; padding: 26px 32px; max-width: 1100px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h3 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 4px; height: 16px; background: var(--gold); border-radius: 2px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- 統計數字卡 ---- */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 4px; }
.stat .value small { font-size: 15px; font-weight: 600; color: var(--muted); }
.stat.accent { border-top: 3px solid var(--gold); }

/* ---- 狀態徽章 ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }
.badge.red   { color: var(--red);   background: var(--red-bg); }
.badge.blue  { color: var(--blue);  background: var(--blue-bg); }
.badge.gray  { color: var(--gray);  background: var(--gray-bg); }

/* ---- 按鈕 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit; transition: .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 6px 13px; font-size: 13px; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px;
  padding: 10px 12px; border-bottom: 2px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); }
tr:hover td { background: #fafbfc; }

/* ---- 進度時間軸 ---- */
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 14px;
  width: 1px; bottom: 0; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-date { font-size: 12px; color: var(--muted); }
.timeline .t-body { font-size: 14px; }
.timeline .t-note { font-size: 13px; color: var(--muted); font-style: italic; }

/* ---- 簽核路徑 ---- */
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow .node { padding: 6px 12px; border-radius: 8px; background: var(--bg);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.flow .node.active { background: var(--navy); color: #fff; }
.flow .node.done { background: var(--green-bg); color: var(--green); }
.flow .arrow { color: var(--muted); }

/* ---- 表單 ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink); font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--navy); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---- 提示 / 空狀態 ---- */
.hint-box { background: var(--amber-bg); color: var(--amber); padding: 10px 14px;
  border-radius: 10px; font-size: 13px; }
.demo-tag { background: var(--gold-soft); color: var(--navy); font-size: 11px;
  padding: 2px 8px; border-radius: 6px; font-weight: 700; }

/* ---- 回應式 ---- */
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; gap: 4px;
    border-right: none; border-bottom: 1px solid var(--line); padding: 10px; }
  .sidebar .nav-section { display: none; }
  .sidebar .nav-item { white-space: nowrap; }
  .main { padding: 18px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar .brand small { display: none; }
}

/* ---- 登入示意畫面 ---- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #f6f8fb 0%, #eaeff6 100%); padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px; padding: 40px 36px; text-align: center;
}
.login-card .logo-badge {
  width: 56px; height: 56px; border-radius: 14px; background: var(--gold);
  color: var(--navy); display: grid; place-items: center; font-weight: 800;
  font-size: 24px; margin: 0 auto 16px;
}
.login-card h1 { font-size: 21px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }
.login-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; transition: .15s;
}
.login-btn:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.login-note {
  margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.8;
  background: var(--bg); border-radius: 10px; padding: 10px 14px;
}
.demo-picker { margin-top: 22px; text-align: left; }
.demo-picker .ttl { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
.demo-user {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); margin-bottom: 6px; cursor: pointer; transition: .15s;
}
.demo-user:hover { background: var(--bg); border-color: var(--navy); }
.demo-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.demo-user .who { font-size: 14px; font-weight: 600; }
.demo-user .role { font-size: 12px; color: var(--muted); }
