:root {
  --bg: #F3F5FA;
  --card: #FFFFFF;
  --ink: #262A40;
  --ink-2: #5C6180;
  --muted: #9AA0B8;
  --line: #E8EBF3;
  --primary: #5B57E6;
  --primary-2: #7C78F0;
  --primary-soft: #ECEBFF;
  --overdue: #E0566B; --overdue-bg: #FFE4E8;
  --soon: #C88A00;    --soon-bg: #FFF3CC;
  --doing: #1E9E91;   --doing-bg: #D8F5F1;
  --todo: #6C5DD3;    --todo-bg: #ECE8FF;
  --done: #8A90A6;    --done-bg: #EEF0F5;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 12px 32px rgba(52, 60, 110, .08);
  --shadow-sm: 0 4px 14px rgba(52, 60, 110, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.danger, .danger-text { color: var(--overdue) !important; }
.center { text-align: center; margin-top: 16px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- 啟動畫面 ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--muted); }
.boot-logo, .brand-mark, .auth-logo {
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--primary), #9C7CF4);
}
.boot-logo { width: 64px; height: 64px; border-radius: 20px; font-size: 30px; box-shadow: var(--shadow); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; transition: transform .1s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91, 87, 230, .28); }
.btn.primary:hover { background: #4E4AD8; }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: #CFD3E4; color: var(--ink); }
.btn.danger { background: var(--overdue); color: #fff !important; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.google { width: 100%; background: #fff; border-color: #DADCE6; color: var(--ink); min-height: 50px; font-size: 16px; box-shadow: var(--shadow-sm); }
.btn.signout { margin-top: 18px; background: var(--card); color: var(--primary); min-height: 54px; font-size: 16px; box-shadow: var(--shadow-sm); }
.g-logo { width: 22px; height: 22px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 13px;
  border: 0; background: var(--bg); color: var(--ink-2); flex: none;
}
.icon-btn:hover { color: var(--ink); background: #E9ECF5; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 10px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }
.icon-btn:disabled { opacity: .35; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 4px 2px; display: inline-flex; align-items: center; gap: 2px; font-size: 14px; }
.link-btn .ic { width: 16px; height: 16px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
.spinner.big { width: 32px; height: 32px; border-width: 3px; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 60px 0; }

/* ---------- 登入 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-card { width: min(420px, 100%); background: var(--card); border-radius: 32px; padding: 0 26px 28px; box-shadow: var(--shadow); text-align: center; overflow: hidden; }
.auth-card h1 { font-size: 26px; margin-top: 4px; }
.auth-sub { color: var(--ink-2); margin: 6px 0 22px; }
.auth-hero { position: relative; height: 170px; margin: 0 -26px 18px; display: grid; place-items: center; background: linear-gradient(160deg, #F4F2FF, #EAF8F6); overflow: hidden; }
.auth-hero.small { height: 130px; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .9; }
.blob.b1 { width: 160px; height: 160px; background: #FFD9E0; left: -40px; top: -50px; }
.blob.b2 { width: 120px; height: 120px; background: #C9F0EA; right: -20px; bottom: -40px; }
.blob.b3 { width: 90px; height: 90px; background: #FFF0B8; right: 60px; top: 20px; }
.auth-logo { position: relative; width: 84px; height: 84px; border-radius: 28px; font-size: 40px; box-shadow: 0 16px 30px rgba(91, 87, 230, .35); }
.auth-logo.warn { background: linear-gradient(135deg, #F7A23B, #E0566B); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 22px 0 16px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: grid; gap: 12px; text-align: left; }
.auth-fine { color: var(--muted); font-size: 13px; margin-top: 18px; }
.code-input { letter-spacing: .4em; font-size: 22px !important; text-align: center; font-weight: 700; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- 表單 ---------- */
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > legend { margin-bottom: 6px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #FAFBFE; outline: none; transition: border-color .2s, background .2s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); background: #fff; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA0B8' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form.one { grid-template-columns: 1fr; }
.span-2 { grid-column: 1 / -1; }
.date-row { display: flex; gap: 6px; align-items: center; }
.date-row input { flex: 1; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check-row input { width: 20px; height: 20px; accent-color: var(--primary); }
.form-project { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.form-project span { flex: 1; color: var(--ink); font-weight: 600; display: grid; }
.form-project small { color: var(--primary); font-weight: 700; font-size: 12px; }
.people-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-person { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); transition: .15s; }
.pick-person input { position: absolute; opacity: 0; pointer-events: none; }
.pick-person:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pick-person.outsider { border-style: dashed; }
.pick-person .av { width: 30px; height: 30px; font-size: 12px; }

/* ---------- 頭像 ---------- */
.av { --c: #8A90A6; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff; font-size: 13px; font-weight: 700; flex: none; letter-spacing: -.5px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.lg { width: 52px; height: 52px; font-size: 18px; }
.av.xl { width: 92px; height: 92px; font-size: 32px; border: 4px solid #fff; box-shadow: var(--shadow); }
.av.empty, .av.more, .av.unknown { background: #E4E7F0; color: var(--ink-2); }
.av-stack { display: flex; align-items: center; }
.av-stack .av { border: 2px solid #fff; box-shadow: none; }
.av-stack .av + .av { margin-left: -8px; }
.inline-person { display: inline-flex; align-items: center; gap: 6px; margin: 2px 10px 2px 0; font-weight: 600; }

/* ---------- 外框 ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { padding-bottom: calc(96px + var(--safe-b)); }
.page { width: min(1180px, 100%); margin: 0 auto; padding: 18px 16px 24px; }
.page.narrow { width: min(760px, 100%); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 8px 10px calc(8px + var(--safe-b)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-radius: 26px 26px 0 0; box-shadow: 0 -8px 30px rgba(52, 60, 110, .08);
}
.bn-link { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.bn-link .ic { width: 24px; height: 24px; }
.bn-link.active { color: var(--primary); }
.bn-link.active::before { content: ""; position: absolute; top: -8px; width: 28px; height: 3px; border-radius: 3px; background: var(--primary); }
.fab {
  justify-self: center; width: 62px; height: 62px; margin-top: -34px; border-radius: 50%; border: 6px solid var(--bg);
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center;
  box-shadow: 0 12px 24px rgba(91, 87, 230, .4);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--overdue); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-style: normal; }

@media (min-width: 960px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; display: flex; flex-direction: column; gap: 14px; padding: 22px 16px; background: var(--card); border-right: 1px solid var(--line); z-index: 20; }
  .main { margin-left: 248px; padding-bottom: 40px; }
  .page { padding: 30px 36px 40px; }
  .bottom-nav { display: none; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 4px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 14px; font-size: 20px; }
  .brand strong { display: block; font-size: 16px; }
  .brand small { color: var(--muted); font-size: 12px; }
  .side-nav { display: grid; gap: 4px; flex: 1; overflow-y: auto; align-content: start; }
  .side-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--ink-2); font-weight: 600; }
  .side-link:hover { background: var(--bg); color: var(--ink); }
  .side-link.active { background: var(--primary-soft); color: var(--primary); }
  .side-link .badge { position: static; margin-left: auto; }
  .side-group { margin: 14px 14px 4px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .08em; }
  .side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--bg); }
  .side-user strong { display: block; font-size: 14px; }
  .side-user small { color: var(--muted); font-size: 12px; }
}

/* ---------- 頁首 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.page-head h1 { font-size: 28px; letter-spacing: -.5px; }
.sub { color: var(--muted); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.today-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 16px; }
.today-head h1 { font-size: 34px; letter-spacing: -.8px; }
.today-head .sub { font-size: 16px; color: var(--ink-2); }
.me-avatar .av { box-shadow: var(--shadow); border: 3px solid #fff; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.back-link .ic { width: 18px; height: 18px; }

/* ---------- 週曆 ---------- */
.week-card { background: var(--card); border-radius: var(--radius); padding: 14px 12px 10px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.week-top { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; color: var(--ink-2); font-size: 14px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.week-nav { display: flex; align-items: center; gap: 4px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.wday { border: 0; background: none; display: grid; justify-items: center; gap: 4px; padding: 6px 0 4px; border-radius: 16px; }
.wday .wd { font-size: 12px; color: var(--muted); font-weight: 600; }
.wday .dn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 600; color: var(--ink); transition: .15s; }
.wday.today .dn { background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.wday.selected .dn { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(91, 87, 230, .35); }
.dots { display: flex; gap: 3px; min-height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.s-overdue { background: var(--overdue); } .dot.s-soon { background: #F2B705; } .dot.s-doing { background: var(--doing); } .dot.s-todo { background: var(--todo); } .dot.s-done { background: #C4C8D6; }
.day-filter { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-weight: 600; margin-bottom: 14px; }
.day-filter span { flex: 1; }

/* ---------- 篩選籤 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -16px 4px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--card); color: var(--ink-2); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); }
.chip b { font-size: 12px; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; background: var(--bg); color: var(--muted); padding: 0 6px; }
.chip.active { background: var(--ink); color: #fff; }
.chip.active b { background: rgba(255, 255, 255, .18); color: #fff; }
.chip.alert:not(.active) b { background: var(--overdue-bg); color: var(--overdue); }
@media (min-width: 960px) { .chips { margin: 0 0 4px; padding-left: 2px; padding-right: 2px; flex-wrap: wrap; } }

/* ---------- 任務卡片 ---------- */
.task-section { margin-top: 8px; }
.task-section h2, .group-title, .cal-list-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 14px 2px 10px; }
.task-section h2 b, .group-title b, .cal-list-title b { font-size: 12px; background: var(--card); color: var(--ink-2); border-radius: 10px; padding: 1px 8px; }
.task-section.overdue h2 { color: var(--overdue); }
.group-title .ic { width: 18px; height: 18px; color: var(--muted); }
.card-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card-grid.one { grid-template-columns: 1fr !important; }
.tcard {
  --tone: var(--todo); --tone-bg: var(--todo-bg);
  position: relative; display: grid; gap: 8px; padding: 16px 18px 14px; border-radius: var(--radius);
  background: var(--tone-bg); cursor: pointer; transition: transform .15s, box-shadow .2s; outline: none;
}
.tcard:hover, .tcard:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.tcard.s-overdue { --tone: var(--overdue); --tone-bg: var(--overdue-bg); }
.tcard.s-soon { --tone: var(--soon); --tone-bg: var(--soon-bg); }
.tcard.s-doing { --tone: var(--doing); --tone-bg: var(--doing-bg); }
.tcard.s-done { --tone: var(--done); --tone-bg: var(--done-bg); }
.tcard.s-done h3 { text-decoration: line-through; text-decoration-color: rgba(138, 144, 166, .6); }
.tc-dot { position: absolute; top: -5px; right: 16px; width: 14px; height: 14px; border-radius: 50%; background: var(--tone); border: 3px solid var(--bg); }
.tc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tc-head h3 { font-size: 17px; line-height: 1.35; color: var(--tone); font-weight: 700; word-break: break-word; }
.tc-due { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--tone); background: rgba(255, 255, 255, .7); padding: 3px 9px; border-radius: 999px; }
.tc-due .ic { width: 14px; height: 14px; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--tone); opacity: .8; font-size: 13.5px; }
.tc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.tc-meta .ic { width: 15px; height: 15px; }
.tc-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .8); }
.tc-status { font-size: 12.5px; font-weight: 700; color: var(--tone); background: #fff; padding: 4px 11px; border-radius: 10px; }
.foot-note { text-align: center; color: var(--muted); font-size: 13px; margin: 26px 0 0; }
.foot-note a { color: var(--primary); font-weight: 600; }

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.pill.s-overdue { background: var(--overdue-bg); color: var(--overdue); }
.pill.s-soon { background: var(--soon-bg); color: var(--soon); }
.pill.s-doing { background: var(--doing-bg); color: var(--doing); }
.pill.s-todo { background: var(--todo-bg); color: var(--todo); }
.pill.s-done { background: var(--done-bg); color: var(--done); }
.pill.p-進行中 { background: var(--doing-bg); color: var(--doing); }
.pill.p-籌備中 { background: var(--todo-bg); color: var(--todo); }
.pill.p-暫停 { background: var(--soon-bg); color: var(--soon); }
.pill.p-已完工, .pill.p-已結案 { background: var(--done-bg); color: var(--done); }
.pill.p-admin { background: var(--primary-soft); color: var(--primary); }

/* ---------- 提示橫幅 ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-radius: 20px; background: linear-gradient(120deg, #EEEBFF, #E3F7F4); margin-bottom: 14px; }
.banner > .ic { width: 26px; height: 26px; color: var(--primary); }
.banner div { flex: 1; display: grid; }
.banner span { color: var(--ink-2); font-size: 13px; }
.notice { display: flex; gap: 12px; text-align: left; padding: 14px; border-radius: 16px; margin-bottom: 16px; }
.notice > .ic { width: 24px; height: 24px; margin-top: 2px; }
.notice div { display: grid; gap: 4px; flex: 1; }
.notice span { font-size: 13px; color: var(--ink-2); }
.notice .btn { justify-self: start; margin-top: 4px; }
.notice.warn { background: var(--soon-bg); color: var(--soon); }
.notice.error { background: var(--overdue-bg); color: var(--overdue); }
.notice.success { background: var(--doing-bg); color: var(--doing); }
.error-list { margin: 0; padding-left: 20px; color: var(--overdue); display: grid; gap: 4px; }

/* ---------- 空白狀態 ---------- */
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--ink-2); }
.empty-art { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; background: var(--doing-bg); color: var(--doing); margin-bottom: 6px; }
.empty-art .ic { width: 30px; height: 30px; }
.empty-state span { color: var(--muted); font-size: 14px; }

/* ---------- 總覽 ---------- */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
@media (min-width: 760px) { .metrics { grid-template-columns: repeat(4, 1fr); } }
.metric { text-align: left; border: 0; display: grid; gap: 2px; padding: 16px 18px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -24px; top: -30px; background: var(--mc-bg); opacity: .9; }
.metric span { font-size: 13px; color: var(--ink-2); font-weight: 600; position: relative; z-index: 1; }
.metric strong { font-size: 30px; line-height: 1.15; color: var(--mc); position: relative; z-index: 1; }
.metric small { color: var(--muted); font-size: 12px; position: relative; z-index: 1; }
.m-purple { --mc: var(--todo); --mc-bg: var(--todo-bg); }
.m-teal { --mc: var(--doing); --mc-bg: var(--doing-bg); }
.m-yellow { --mc: var(--soon); --mc-bg: var(--soon-bg); }
.m-pink { --mc: var(--overdue); --mc-bg: var(--overdue-bg); }
.m-gray { --mc: var(--done); --mc-bg: var(--done-bg); }
.metrics.compact { margin-bottom: 14px; }
.metrics.compact .metric { padding: 12px 16px; }
.metrics.compact .metric strong { font-size: 24px; }
.metric.active { outline: 2.5px solid var(--mc); }
.block { margin-bottom: 26px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.block-head h2 { font-size: 19px; }
.project-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .project-grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { background: var(--card); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .15s, box-shadow .2s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pc-top { display: flex; gap: 14px; align-items: center; }
.pc-title h3 { font-size: 16px; line-height: 1.4; }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pc-stats span, .pr-nums span { display: grid; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.pc-stats b, .pr-nums b { font-size: 18px; color: var(--ink); }
.pc-stats .danger b, .pr-nums .danger b { color: var(--overdue); }
.pc-foot { display: flex; align-items: center; justify-content: space-between; }
.ring .ring-bg { fill: none; stroke: #EEF0F6; }
.ring .ring-fg { fill: none; stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring text { font-size: 13px; font-weight: 800; fill: var(--ink); }
.people-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .people-list { grid-template-columns: 1fr 1fr; } }
.person-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: var(--card); border-radius: 18px; text-align: left; box-shadow: var(--shadow-sm); }
.pr-main { flex: 1; display: grid; gap: 6px; min-width: 0; }
.bar { display: block; height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.pr-nums { display: flex; gap: 6px; }
.pr-nums span { padding: 4px 8px; min-width: 52px; text-align: center; }
.pr-nums b { font-size: 15px; }
@media (max-width: 520px) { .pr-nums span:last-child { display: none; } }

/* ---------- 案件頁 ---------- */
.project-hero { display: grid; grid-template-columns: auto 1fr; gap: 16px 18px; align-items: center; background: var(--card); border-radius: 26px; padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.ph-main h1 { font-size: 21px; line-height: 1.35; margin: 2px 0; }
.ph-main .sub { font-size: 13px; }
.ph-people { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.ph-resp, .ph-members { display: inline-flex; align-items: center; gap: 6px; }
.ph-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 900px) { .project-hero { grid-template-columns: auto 1fr auto; } .ph-actions { grid-column: auto; flex-direction: column; } .ph-main h1 { font-size: 24px; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.toolbar select { width: auto; min-width: 130px; flex: 1 1 130px; }
.search { position: relative; flex: 1 1 100%; display: flex; align-items: center; }
.search .ic { position: absolute; left: 13px; color: var(--muted); width: 18px; height: 18px; }
.search input { padding-left: 40px; background: var(--card); }
@media (min-width: 900px) { .search { flex: 1 1 260px; } .toolbar select { flex: 0 1 180px; } }
.seg { display: inline-flex; background: #E6E9F2; padding: 4px; border-radius: 14px; gap: 2px; }
.seg button { border: 0; background: none; height: 36px; min-width: 40px; padding: 0 10px; border-radius: 10px; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-weight: 600; font-size: 14px; }
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.seg button .ic { width: 18px; height: 18px; }
.count-line { margin: 6px 2px 10px; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-sm); }
.table-wrap.small { max-height: 340px; margin-top: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { position: sticky; top: 0; background: #F7F8FC; text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 12px; white-space: nowrap; }
.data-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; }
.data-table td small { display: block; color: var(--muted); }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #FAFBFF; }
.data-table td.notes { color: var(--ink-2); max-width: 260px; font-size: 13px; }
.row-s-overdue td:first-child { box-shadow: inset 4px 0 var(--overdue); }
.row-s-soon td:first-child { box-shadow: inset 4px 0 #F2B705; }
.row-s-done { opacity: .7; }

/* ---------- 行事曆 ---------- */
.cal-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .cal-layout { grid-template-columns: minmax(420px, 1.1fr) 1fr; align-items: start; } }
.cal-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-top h2 { font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal-day { position: relative; border: 0; background: none; aspect-ratio: 1 / 1; border-radius: 14px; display: grid; place-content: center; justify-items: center; gap: 3px; font-weight: 600; font-size: 15px; }
.cal-day:hover { background: var(--bg); }
.cal-day.other { color: #C7CBD8; }
.cal-day.today { background: var(--primary-soft); color: var(--primary); }
.cal-day.selected { background: var(--primary); color: #fff; }
.cal-day.selected .dot { box-shadow: 0 0 0 1.5px #fff; }
.cal-day em { position: absolute; top: 3px; right: 5px; font-size: 10px; font-style: normal; color: var(--muted); }
.cal-day.selected em { color: rgba(255, 255, 255, .8); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-list-title { margin-top: 4px; }

/* ---------- 通知 ---------- */
.notif-group h2 { font-size: 16px; margin: 18px 2px 10px; }
.notif { width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 14px; margin-bottom: 8px; border: 0; background: var(--card); border-radius: 18px; text-align: left; box-shadow: var(--shadow-sm); position: relative; }
.notif.unread::after { content: ""; position: absolute; top: 14px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--overdue); }
.notif-ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.notif-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.notif-main span { color: var(--ink-2); font-size: 14px; }
.notif:not(.unread) .notif-main strong { color: var(--ink-2); font-weight: 600; }
.notif time { font-size: 12px; color: var(--muted); margin-right: 14px; white-space: nowrap; }
.k-purple { background: var(--todo-bg); color: var(--todo); }
.k-teal { background: var(--doing-bg); color: var(--doing); }
.k-yellow { background: var(--soon-bg); color: var(--soon); }
.k-pink { background: var(--overdue-bg); color: var(--overdue); }
.k-green { background: #DFF5E3; color: #2E9E4F; }

/* ---------- 我的 ---------- */
.profile { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 30px 16px 26px; margin-bottom: 18px; border-radius: 0 0 60px 60px; overflow: hidden; }
.profile-bg { position: absolute; inset: 0; background: linear-gradient(160deg, #EEEBFF, #E4F7F4); border-radius: 30px 30px 80px 30px; z-index: -1; }
.profile h1 { font-size: 22px; margin-top: 8px; }
.menu { display: grid; gap: 4px; background: var(--card); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow-sm); }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; border: 0; background: none; text-align: left; width: 100%; font-size: 16px; font-weight: 600; }
a.menu-item:hover, button.menu-item:hover { background: var(--bg); }
.menu-item > span:not(.mi-ic) { flex: 1; display: grid; }
.menu-item small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.mi-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none; }
.mi-ic .ic { width: 22px; height: 22px; }
.menu-item .count { background: var(--primary); color: #fff; font-size: 13px; min-width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; padding: 0 7px; }
.menu-item .chev { color: var(--muted); }
.menu-group { margin: 10px 12px 2px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: #D9DCE7; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transition: .2s; }
.switch input:checked + i { background: var(--doing); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled + i { opacity: .5; cursor: default; }
.switch.small { width: 42px; height: 26px; }
.switch.small i::after { width: 20px; height: 20px; }
.switch.small input:checked + i::after { transform: translateX(16px); }

/* ---------- 彈出視窗（手機為底部滑出） ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(30, 33, 55, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .22s; }
.overlay.open { background: rgba(30, 33, 55, .38); }
.sheet {
  width: 100%; max-height: 92vh; background: var(--card); border-radius: 28px 28px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 -10px 40px rgba(30, 33, 55, .15);
}
.overlay.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: #DDE0EA; margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 20px 10px; }
.sheet-head h2 { font-size: 20px; line-height: 1.35; }
.sheet-body { padding: 6px 20px 18px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex: none; }
.confirm-text { color: var(--ink-2); font-size: 16px; }
@media (min-width: 760px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { width: 520px; max-height: 88vh; border-radius: 28px; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .22s, opacity .22s; }
  .overlay.open .sheet { opacity: 1; }
  .sheet.wide { width: 760px; }
  .sheet.small { width: 440px; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 20px; }
  .sheet-foot { padding-bottom: 14px; }
}
@media (max-width: 759px) { .form { grid-template-columns: 1fr; } }

/* 任務詳情 */
.task-sheet .sheet-head { padding-bottom: 14px; }
.tone-overdue .sheet-head { background: linear-gradient(180deg, var(--overdue-bg), #fff); }
.tone-soon .sheet-head { background: linear-gradient(180deg, var(--soon-bg), #fff); }
.tone-doing .sheet-head { background: linear-gradient(180deg, var(--doing-bg), #fff); }
.tone-todo .sheet-head { background: linear-gradient(180deg, var(--todo-bg), #fff); }
.tone-done .sheet-head { background: linear-gradient(180deg, var(--done-bg), #fff); }
.tabs { margin: 4px 0 16px; }
.status-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.sp { border: 1.5px solid var(--line); background: #fff; border-radius: 14px; min-height: 42px; padding: 0 14px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.sp .ic { width: 16px; height: 16px; }
.sp.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.sp.done:not(.active) { border-color: #BDE8E2; color: var(--doing); background: var(--doing-bg); }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .info-grid { grid-template-columns: repeat(3, 1fr); } }
.info { background: var(--bg); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.info > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.info strong { font-size: 15px; word-break: break-word; }
.info strong small { display: block; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.info.danger strong, .info.danger strong small { color: var(--overdue); }
.notes-box { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.notes-box p:last-child { margin-top: 4px; white-space: normal; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: flex; gap: 10px; }
.timeline p { font-size: 14px; color: var(--ink-2); }
.timeline time { font-size: 12px; color: var(--muted); }
.chg { display: block; margin-top: 2px; }
.chg b { color: var(--ink); }
.project-pick { display: grid; gap: 10px; margin-top: 8px; }
.pp { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; border: 1.5px solid var(--line); background: #fff; text-align: left; font-weight: 600; }
.pp:hover { border-color: var(--primary-2); background: var(--primary-soft); }
.pp span { display: grid; }
.pp small { color: var(--muted); }
.pp .ring text { font-size: 11px; }
.calc-result { background: var(--primary-soft); border-radius: 16px; padding: 14px; display: grid; }
.calc-result span { font-size: 12px; color: var(--primary); font-weight: 700; }
.calc-result strong { font-size: 18px; }

/* 分類設定 */
.opt-section { margin-bottom: 20px; }
.opt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.opt-head h3 { font-size: 16px; }
.opt-add { display: flex; gap: 6px; flex: 1 1 240px; max-width: 360px; }
.opt-add input { min-height: 38px; padding: 6px 12px; }
.opt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.opt-list li { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; background: var(--bg); border-radius: 14px; }
.opt-list li.inactive .opt-name { color: var(--muted); text-decoration: line-through; }
.opt-name { min-height: 38px !important; padding: 6px 10px !important; background: transparent !important; border-color: transparent !important; flex: 1; }
.opt-name:focus { background: #fff !important; border-color: var(--primary-2) !important; }

/* 管理頁 */
.panel { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.panel h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 6px; }
.panel h2 .ic { color: var(--primary); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: flex-end; }
.inline-form .field { width: 160px; }
.backup-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.backup-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg); border-radius: 12px; }
.backup-list span { font-weight: 600; }
.backup-list small { flex: 1; color: var(--muted); }
.person-cards { display: grid; gap: 10px; }
.person-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 0; background: var(--card); border-radius: 20px; text-align: left; box-shadow: var(--shadow-sm); }
.person-card.inactive { opacity: .6; }
.pc-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.pc-main strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-main span { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.pc-main small { color: var(--muted); font-size: 12px; }
.person-card .chev { color: var(--muted); }
.trash-list { display: grid; gap: 10px; }
.trash-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); }
.trash-item > div { flex: 1 1 240px; display: grid; gap: 2px; }
.trash-item small { color: var(--muted); }
.guide { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 12px; }
.guide li { display: flex; gap: 12px; align-items: flex-start; }
.guide b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.guide .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--primary); }

/* ---------- 提示訊息 ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 30px rgba(30, 33, 55, .3); transition: .25s; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--overdue); }
#toast.success { background: var(--doing); }
@media (min-width: 960px) { #toast { bottom: 30px; } }

/* ---------- 第二版：搜尋 ---------- */
.today-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn.round { width: 46px; height: 46px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink-2); }
.search-hero { display: flex; gap: 10px; margin-bottom: 12px; }
.search.big input { min-height: 52px; font-size: 16px; border-radius: 16px; box-shadow: var(--shadow-sm); border-color: transparent; }
.search.big input:focus { border-color: var(--primary-2); }
.search-hero .btn { min-height: 52px; border-radius: 16px; }
.preset-row { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 2px 16px 6px; }
.preset-row::-webkit-scrollbar { display: none; }
.preset-row > .muted { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.preset-row > .muted .ic { width: 15px; height: 15px; color: #F2B705; }
.preset-row .chip { height: 34px; font-size: 13px; }
.saved-chip { padding: 0 4px 0 0; background: #FFF8DB; gap: 0; }
.saved-chip button { border: 0; background: none; font: inherit; color: var(--ink); font-weight: 600; height: 34px; padding: 0 6px 0 14px; }
.saved-chip button.x { padding: 0 6px; color: var(--muted); display: grid; place-items: center; }
.saved-chip button.x .ic { width: 14px; height: 14px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin: 6px 0 16px; }
.fbtn { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 10px 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #FAFBFE; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.fbtn .ic { width: 15px; height: 15px; color: var(--muted); }
.fbtn b { font-size: 12px; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; background: var(--primary); color: #fff; padding: 0 6px; text-align: center; }
.fbtn.on, .fsel.on { border-color: var(--primary-2); background: var(--primary-soft); color: var(--primary); }
.filter-bar select.fsel { width: auto; min-height: 38px; height: 38px; padding: 0 32px 0 12px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.filter-bar select.fsel.on { color: var(--primary); }
.date-pair { display: inline-flex; align-items: center; gap: 4px; }
.date-pair input { min-height: 38px !important; height: 38px; padding: 0 8px !important; width: 150px !important; border-radius: 12px !important; }
.result-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.result-bar .seg.tabs button b { font-size: 12px; color: var(--muted); font-weight: 700; }
.result-bar .seg.tabs button.active b { color: var(--primary); }
.search-intro { padding-top: 10px; }
.group-title a { display: inline-flex; align-items: center; gap: 6px; }
.group-title a:hover { color: var(--primary); }
.search-tl li[data-act] { cursor: pointer; padding: 10px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-sm); }
.search-tl li[data-act]:hover { box-shadow: var(--shadow); }
.search-tl li.deleted { padding: 10px 12px; border-radius: 16px; background: var(--done-bg); opacity: .8; }
.search-tl .eyebrow { font-size: 12px; color: var(--muted); font-weight: 600; }
.search-tl { gap: 10px; }
.picker-sheet .search { margin-bottom: 10px; }
.pick-list { display: grid; gap: 4px; max-height: 52vh; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); cursor: pointer; }
.pick-item input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.pick-item span { display: grid; }
.pick-item small { color: var(--muted); font-size: 12px; }
.pick-item:has(input:checked) { background: var(--primary-soft); }

/* ---------- 第二版：Google 行事曆行程 ---------- */
.dot.ev { background: transparent; box-shadow: inset 0 0 0 1.6px var(--primary); }
.ev-list { display: grid; gap: 8px; }
.ev-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1.5px dashed #CBC8F7; background: var(--card); border-radius: 16px; padding: 10px 12px; }
.ev-row:hover { border-color: var(--primary-2); background: #FBFAFF; }
.ev-date { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ev-date b { font-size: 20px; }
.ev-date small { font-size: 11px; font-weight: 600; }
.ev-main { display: grid; gap: 2px; min-width: 0; }
.ev-main strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-main small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12.5px; }
.ev-main small span { display: inline-flex; align-items: center; gap: 3px; }
.ev-main small .ic { width: 14px; height: 14px; }
.ev-main em { font-style: normal; color: var(--soon); background: var(--soon-bg); border-radius: 6px; padding: 0 6px; }
.ev-block { margin: 4px 0 14px; }
.ev-block .block-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; }
.ev-block .block-head h2 .ic { color: var(--primary); }
.ev-block .link-btn { margin-top: 6px; }
.ev-hint { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.ev-hint .ic { width: 16px; height: 16px; }
.cal-list .label { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; }
.cal-list .label .ic { width: 16px; height: 16px; }
.cal-list .ev-list + .label { margin-top: 16px; }
.check-row.compact { font-size: 14px; color: var(--ink-2); gap: 6px; }
.check-row.compact input { width: 18px; height: 18px; }
.info-grid.one { grid-template-columns: 1fr; }
.ghost-slot { visibility: hidden; }
.opt-list .danger-text { background: none; }

/* ---------- 第二版：新圖示 ---------- */
.logo-svg { display: block; width: 100%; height: 100%; }
.boot-logo, .brand-mark, .auth-logo { overflow: hidden; }

@media (max-width: 640px) {
  .search-hero .btn span { display: none; }
  .search-hero .btn { padding: 0 16px; }
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; border-radius: 0; padding: 10px 16px; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar > * { flex: none; }
  .result-bar .btn span { display: none; }
}
.boot-logo:has(.logo-svg), .brand-mark:has(.logo-svg), .auth-logo:has(.logo-svg) { background: none; }

/* ---------- 第三版：入口、出工日誌、出勤確認 ---------- */
.emo { font-size: 20px; line-height: 1; flex: none; width: 24px; text-align: center; }

/* 手機每頁右上角的通知鈴鐺（電腦版用側邊選單） */
.bell-btn { position: relative; flex: none; }
.bell-btn .badge { top: -2px; left: auto; right: -4px; }
.page-head .bell-btn { margin-left: auto; align-self: center; order: 3; }
.page-head > div:first-child { min-width: 0; }
@media (max-width: 959px) { .page-head { align-items: center; } .page-head .head-actions { order: 4; width: 100%; } }
@media (min-width: 960px) { .bell-btn { display: none !important; } }
.back-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.back-row .back-link { margin-bottom: 10px; }
.back-row .bell-btn { width: 40px; height: 40px; margin-bottom: 8px; }

/* 待辦上方提示列 */
.today-strip { display: grid; gap: 8px; margin-bottom: 14px; }
@media (min-width: 760px) { .today-strip { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
.today-strip.wide { margin-top: -4px; }
.strip-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; padding: 12px 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-sm); color: var(--ink); }
.strip-item > .ic:first-child { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 12px; }
.strip-item > span { flex: 1; display: grid; gap: 2px; min-width: 0; }
.strip-item strong { font-size: 15px; }
.strip-item small { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-item > .chev { width: 18px; height: 18px; padding: 0; background: none; color: var(--muted); flex: none; }
.strip-item.warn > .ic:first-child { background: var(--soon-bg); color: var(--soon); }
.strip-item.alert > .ic:first-child { background: var(--overdue-bg); color: var(--overdue); }
.strip-item.ok { box-shadow: none; background: transparent; padding: 4px 6px; }
.strip-item.ok > .ic:first-child { width: 26px; height: 26px; padding: 5px; background: var(--doing-bg); color: var(--doing); border-radius: 9px; }
.strip-item.ok strong { font-size: 13.5px; color: var(--doing); }
.log-status-list { display: grid; gap: 8px; margin-bottom: 12px; }
.ls-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--bg); }
.ls-row.done { opacity: .75; }
.ls-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--soon-bg); color: var(--soon); flex: none; }
.ls-row.done .ls-ic { background: var(--doing-bg); color: var(--doing); }
.ls-main { flex: 1; display: grid; min-width: 0; }
.ls-main small { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; margin-right: 3px; }
.pill.log-ok { background: var(--doing-bg); color: var(--doing); }
.pill.log-miss { background: var(--soon-bg); color: var(--soon); }
.pc-foot { flex-wrap: wrap; gap: 6px; }

/* 施工日誌 */
.wl-block, .pl-block { margin: 4px 0 14px; }
.wl-block .block-head, .pl-block .block-head { flex-wrap: wrap; }
.wl-block .block-head h2, .pl-block .block-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; }
.wl-block .block-head h2 .ic, .pl-block .block-head h2 .ic { color: var(--doing); }
.wl-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wl-list { display: grid; gap: 8px; margin-bottom: 6px; }
@media (min-width: 1100px) { .page:not(.narrow) .wl-list { grid-template-columns: 1fr 1fr; } }
.wlog { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer; border: 1.5px solid transparent; }
.wlog:hover { border-color: #BFE9E3; }
.wlog .ev-date { background: var(--doing-bg); color: var(--doing); }
.wlog.flag { border-color: #F4D58A; }
.wl-main { flex: 1; display: grid; gap: 4px; min-width: 0; }
.wl-main strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-proj { font-style: normal; color: var(--primary); margin-right: 6px; }
.wl-text { color: var(--ink-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.wl-main small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12.5px; }
.wl-main small span { display: inline-flex; align-items: center; gap: 3px; }
.wl-main small .ic { width: 14px; height: 14px; }
.wl-main small .pill { height: 20px; font-size: 11px; padding: 0 8px; }
.pill.st-已確認, .pill.st-已列入請款 { background: var(--doing-bg); color: var(--doing); }
.pill.st-退回補正 { background: var(--overdue-bg); color: var(--overdue); }
.pill.st-待審核 { background: var(--todo-bg); color: var(--todo); }
.wl-note, .wl-flag { display: flex; align-items: flex-start; gap: 5px; font-size: 13px; border-radius: 10px; padding: 5px 8px; }
.wl-note { background: #FFF6E5; color: #8A5A00; white-space: pre-line; }
.wl-flag { background: var(--soon-bg); color: var(--soon); font-weight: 600; }
.wl-note .ic, .wl-flag .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.notes-box.warn { background: #FFF6E5; }
.notes-box .label { display: flex; align-items: center; gap: 5px; }
.notes-box .label .ic { width: 15px; height: 15px; }
.sub-title { display: flex; align-items: center; gap: 6px; font-size: 15px; margin: 16px 0 8px; }
.sub-title .ic { width: 17px; height: 17px; color: var(--muted); }
.sub-title b { font-size: 12px; background: var(--bg); color: var(--muted); border-radius: 9px; padding: 1px 7px; }
.data-table tr.row-flag td { background: #FFF8E1; }
.att-note { display: inline-flex; align-items: center; gap: 4px; color: var(--soon); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.att-note .ic { width: 14px; height: 14px; }
.month-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.month-nav strong { font-size: 17px; min-width: 110px; text-align: center; }
.month-nav .muted { margin-left: auto; }

/* 案件相關連結 */
.pl-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-item { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow-sm); font-weight: 600; font-size: 14px; }
.pl-item:hover { color: var(--primary); }
.pl-item > span:last-child { display: grid; }
.pl-item small { color: var(--muted); font-weight: 500; font-size: 12px; }
.pl-item .ic { width: 18px; height: 18px; color: var(--primary); }
.pl-item.is-hidden { opacity: .5; }

/* 入口頁 */
.portal-sec { margin-bottom: 20px; }
.ps-title { display: flex; align-items: center; gap: 8px; font-size: 18px; margin-bottom: 10px; flex-wrap: wrap; }
.ps-title small { font-size: 13px; color: var(--muted); font-weight: 500; }
.portal-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .portal-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .portal-tiles { grid-template-columns: repeat(4, 1fr); } }
.ptile { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 14px; min-height: 76px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow-sm); transition: transform .12s; }
.ptile:active { transform: scale(.97); }
.ptile:hover { box-shadow: var(--shadow); }
.pt-ic { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; background: var(--primary-soft); }
.portal-tiles .ptile:nth-child(4n+2) .pt-ic { background: var(--doing-bg); }
.portal-tiles .ptile:nth-child(4n+3) .pt-ic { background: var(--soon-bg); }
.portal-tiles .ptile:nth-child(4n+4) .pt-ic { background: var(--overdue-bg); }
.pt-main { display: grid; min-width: 0; }
.pt-main strong { font-size: 15.5px; line-height: 1.3; }
.pt-main small { font-size: 12px; color: var(--muted); }
.aud { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 0 5px; }
.portal-btns { display: grid; gap: 8px; }
@media (min-width: 760px) { .portal-btns { grid-template-columns: repeat(2, 1fr); } }
.pbtn { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-sm); font-weight: 600; }
.pbtn:hover { color: var(--primary); }
.pbtn .ic { width: 18px; height: 18px; color: var(--primary); flex: none; }
.portal-cal { margin: 6px 0 20px; }
.portal-cal .block-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; }
.portal-cal .block-head h2 .ic { color: var(--primary); }
.pday { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); margin-bottom: 8px; overflow: hidden; }
.pday summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 700; cursor: pointer; }
.pday summary::-webkit-details-marker { display: none; }
.pday summary span { flex: 1; }
.pday summary b { font-size: 12px; background: var(--primary-soft); color: var(--primary); border-radius: 9px; padding: 1px 8px; }
.pday summary .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
.pday[open] summary .chev { transform: rotate(180deg); }
.pday .ev-list { padding: 0 10px 10px; }
.pday .ev-row { border-style: solid; border-color: var(--line); }
.contact-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.contact-card .block-head h2 { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; }
.contact-card .block-head h2 .ic { color: var(--primary); }
.cc-name { font-weight: 700; margin-bottom: 8px; }
.cc-list { display: grid; gap: 4px; }
.cc-list > a, .cc-list > span { display: flex; align-items: center; gap: 10px; padding: 8px 4px; color: var(--ink-2); font-size: 14.5px; }
.cc-list > a { color: var(--ink); }
.cc-list > a:hover { color: var(--primary); }
.cc-list .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }

/* 登入畫面下方的公開連結 */
.pub-links { text-align: left; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.pub-links summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; color: var(--ink-2); font-size: 14px; }
.pub-links summary::-webkit-details-marker { display: none; }
.pub-links summary .ic { width: 18px; height: 18px; }
.pub-links summary .chev { margin-left: auto; transition: transform .15s; }
.pub-links[open] summary .chev { transform: rotate(180deg); }
.pub-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.pub-list { display: grid; gap: 6px; }
.pub-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--bg); font-weight: 600; font-size: 14px; }
.pub-list a > span:last-child { display: grid; }
.pub-list small { color: var(--muted); font-weight: 500; font-size: 12px; }
.pub-list .ic { width: 16px; height: 16px; color: var(--primary); }

/* 入口設定 */
.pa-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pa-head h2 { margin: 0; }
.pa-links { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.pa-links li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; background: var(--bg); border-radius: 14px; }
.pa-links li.inactive { opacity: .55; }
.pa-ic { flex: none; width: 28px; display: grid; place-items: center; }
.pa-ic .ic { width: 18px; height: 18px; color: var(--primary); }
.pa-main { flex: 1; display: grid; min-width: 0; }
.pa-main strong { font-size: 14.5px; }
.pa-main small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.aud-public { background: var(--doing-bg); color: var(--doing); }
.pill.aud-member { background: var(--todo-bg); color: var(--todo); }
.pill.aud-admin { background: var(--overdue-bg); color: var(--overdue); }
@media (max-width: 640px) { .pa-links li .pill { display: none; } .pa-links li.inactive .pill.s-done { display: inline-flex; } }
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.emoji-input { width: 64px !important; text-align: center; font-size: 20px; }
.emoji-pick { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--bg); font-size: 19px; }
.emoji-pick:hover { background: var(--primary-soft); }
.form-group { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-group .ic { width: 18px; height: 18px; color: var(--doing); }
.source-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.source-list li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; background: var(--bg); border-radius: 12px; }
.source-list li.inactive { opacity: .6; }
.src-main { flex: 1; display: grid; min-width: 0; gap: 2px; }
.src-main small { color: var(--muted); font-size: 12px; }
.src-main em { font-style: normal; font-size: 12.5px; display: flex; gap: 4px; align-items: flex-start; }
.src-main em .ic { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.mono { font-family: ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form .field.grow { flex: 1 1 280px; width: auto; }

/* 出勤確認 */
.att-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 12px; border: 1.5px solid transparent; }
.att-card.pending { border-color: #F4D58A; }
.att-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.att-card h3 { font-size: 19px; }
.att-reason { display: flex; align-items: flex-start; gap: 6px; color: var(--soon); font-size: 13.5px; font-weight: 600; margin: 8px 0 10px; }
.att-reason .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.att-proj { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); margin-bottom: 8px; }
.att-proj.ok { background: #EAF8F5; }
.att-ph { display: grid; }
.att-ph small { color: var(--ink-2); font-size: 12.5px; }
.att-hours { display: flex; gap: 8px; }
.att-hours span { flex: 1; display: grid; justify-items: center; background: var(--card); border-radius: 12px; padding: 6px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.att-hours b { font-size: 20px; color: var(--ink); }
.att-entries { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.att-entries span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.att-entries .link-btn { font-size: 12.5px; padding: 0 2px; }
.att-entries .link-btn .ic { width: 13px; height: 13px; }
.att-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ok-text { display: inline-flex; align-items: center; gap: 4px; color: var(--doing); font-weight: 600; font-size: 13px; }
.ok-text .ic { width: 15px; height: 15px; }
.att-other { font-size: 13px; color: var(--ink-2); background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.page > .seg.tabs { margin-bottom: 14px; }
.page > .seg.tabs b { font-size: 11px; background: var(--bg); color: var(--muted); border-radius: 8px; padding: 0 6px; margin-left: 2px; }
