/* ========================================================================
   偉騰專案追蹤管理系統 — 設計系統
   調性：公司官網的「紙色＋墨色」編輯感（paper #F7F3E8 / ink #12110E），
   品牌青綠與萊姆只作點綴；頂部導覽列版型、日期磚時程列，與報價系統（深青綠側欄）明確區隔。
   ======================================================================== */
:root {
  --font: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 品牌色（取自 wddev.com.tw 設計 token） */
  --teal: #28b4b4; --teal-deep: #157070; --teal-ink: #0d4e4e; --teal-tint: rgba(40, 180, 180, 0.12);
  --lime: #78dc28; --lime-deep: #5fb81a; --lime-tint: rgba(120, 220, 40, 0.16);
  --copper: #8e5a31; --copper-soft: #d4a574; --copper-tint: #faf3ea;
  --paper: #f7f3e8; --paper-raised: #fcfaf3; --paper-recessed: #f1ead8;
  --ink: #12110e; --ink-2: #54514a; --ink-3: #716c5e; --ink-4: #9a9384;
  --grad-brand: linear-gradient(90deg, #157070 0%, #28b4b4 55%, #78dc28 100%);

  --bg: var(--paper);
  --surface: var(--paper-raised);
  --surface-2: #f4efe2;
  --surface-3: #ece6d4;
  --input-bg: #ffffff;
  --border: #e7e2d6;
  --border-2: #d6cfbe;
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: #857f71;

  --primary: var(--ink);
  --primary-hover: #2a2823;
  --on-primary: var(--paper);
  --primary-soft: var(--teal-tint);
  --primary-ring: rgba(40, 180, 180, 0.35);
  --accent: var(--teal);
  --accent-deep: var(--teal-deep);
  --link: var(--teal-deep);

  --red: #9c3e3e;      --red-soft: #f5e3e0;
  --orange: #b9641e;   --orange-soft: #f8e7d6;
  --amber: #a27710;    --amber-soft: #f6ecd1;
  --green: #3f8f2e;    --green-soft: #e6f3d8;
  --teal-c: #157070;   --teal-soft: #dcf0ee;
  --blue: #3a5f9e;     --blue-soft: #e2e9f4;
  --indigo: #5a5aa0;   --indigo-soft: #e7e6f3;
  --purple: #7a4f9e;   --purple-soft: #eee6f3;
  --lime-c: #4f9a12;   --lime-soft: #e9f6d6;
  --gray: #716c5e;     --gray-soft: #ece7db;
  --slate: #54514a;    --slate-soft: #e4dfd2;

  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 0 rgba(18, 17, 14, 0.04), 0 1px 2px rgba(18, 17, 14, 0.05);
  --shadow: 0 1px 0 rgba(18, 17, 14, 0.04), 0 12px 30px -22px rgba(18, 17, 14, 0.4);
  --shadow-lg: 0 2px 0 rgba(18, 17, 14, 0.04), 0 28px 70px -30px rgba(18, 17, 14, 0.5);
  --appbar-h: 64px;
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #12110e;
  --surface: #1b1a16;
  --surface-2: #22201b;
  --surface-3: #2b2922;
  --input-bg: #16150f;
  --border: #33302a;
  --border-2: #48443b;
  --text: #f3efe4;
  --text-2: #bdb7a8;
  --text-3: #85806f;

  --primary: #f7f3e8;
  --primary-hover: #ffffff;
  --on-primary: #12110e;
  --primary-soft: rgba(79, 200, 198, 0.16);
  --primary-ring: rgba(79, 200, 198, 0.4);
  --teal: #4fc8c6; --teal-deep: #7fdad9; --teal-tint: rgba(79, 200, 198, 0.16);
  --lime: #b4ec6a; --lime-deep: #96d93f; --lime-tint: rgba(180, 236, 106, 0.16);
  --link: #7fdad9;
  --grad-brand: linear-gradient(90deg, #7fdad9 0%, #4fc8c6 45%, #b4ec6a 100%);

  --red: #e08a82;      --red-soft: #3a2422;
  --orange: #e9a068;   --orange-soft: #3a2a1a;
  --amber: #e0b85a;    --amber-soft: #383018;
  --green: #8fd36a;    --green-soft: #22331a;
  --teal-c: #7fdad9;   --teal-soft: #173634;
  --blue: #93b0e2;     --blue-soft: #1f2a3c;
  --indigo: #a6a6e6;   --indigo-soft: #26263e;
  --purple: #bda2e4;   --purple-soft: #2d243c;
  --lime-c: #b4ec6a;   --lime-soft: #26331a;
  --gray: #a39d8d;     --gray-soft: #2a2822;
  --slate: #bdb7a8;    --slate-soft: #33302a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: 15px; } h3 { font-size: 16px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icon { width: 1.2em; height: 1.2em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -0.22em; }
.icon.lg { width: 1.6em; height: 1.6em; }
::selection { background: var(--teal-tint); }

/* ---------- boot ---------- */
.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 14px; color: var(--text-3); text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--teal); animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登入：左墨色文案欄 ＋ 右表單 ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); background: var(--bg); }
.auth-side { background: #12110e; color: #f7f3e8; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; right: -22%; bottom: -36%; width: 78%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 40% 40%, rgba(40, 180, 180, 0.42), rgba(120, 220, 40, 0.1) 55%, transparent 72%); pointer-events: none; }
.auth-side > * { position: relative; }
.auth-lockup { display: flex; align-items: center; gap: 16px; }
.auth-lockup img { width: 72px; height: 72px; display: block; flex-shrink: 0; }
.auth-lockup .l1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: #fff; }
.auth-lockup .l2 { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 700; color: #4fc8c6; margin-top: 6px; }
.auth-side .rule { height: 3px; width: 112px; background: var(--grad-brand); border-radius: 2px; margin-top: 26px; }
.auth-side h2 { font-size: 32px; line-height: 1.28; font-weight: 800; letter-spacing: -0.02em; margin: 22px 0 14px; color: #fff; max-width: 16em; }
.auth-side p { color: rgba(247, 243, 232, 0.72); font-size: 15px; line-height: 1.75; max-width: 40ch; }
.auth-side ul { margin-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.auth-side li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: rgba(247, 243, 232, 0.88); line-height: 1.6; }
.auth-side li .icon { color: #78dc28; margin-top: 3px; width: 17px; height: 17px; }
.auth-side .foot { font-size: 12px; color: rgba(247, 243, 232, 0.45); margin-top: 40px; }
.auth-main { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 400px; animation: pop 0.25s ease-out; }
.auth-mobile-logo { display: none; }
.auth-mobile-logo .l1 { color: var(--text); font-size: 21px; }
.auth-mobile-logo .l2 { color: var(--teal-deep); }
.auth-sys { font-size: 11.5px; letter-spacing: 0.2em; color: var(--teal-deep); font-weight: 700; text-transform: uppercase; margin-bottom: 10px; }
.auth-card h1 { font-size: 27px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 26px; font-size: 13.5px; line-height: 1.65; }
.auth-card .input { height: 44px; background: var(--input-bg); }
.auth-foot { margin-top: 22px; color: var(--text-3); font-size: 12px; }
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { align-items: start; padding-top: 48px; }
  .auth-mobile-logo { display: flex; justify-content: center; margin: 0 auto 26px; }
  .auth-mobile-logo img { width: 56px; height: 56px; }
}

/* ---------- 版型：頂部導覽列 ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(140%) blur(12px); -webkit-backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid var(--border); }
.appbar-inner { height: var(--appbar-h); display: flex; align-items: center; gap: 14px; padding: 0 24px; max-width: 1480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; flex-shrink: 0; padding-right: 14px; margin-right: 2px; border-right: 1px solid var(--border); height: 36px; }
.brand:hover { text-decoration: none; }
.brand img { height: 36px; width: 36px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-co { font-size: 10.5px; letter-spacing: 0.14em; color: var(--text-3); font-weight: 600; text-transform: uppercase; }
.brand-sys { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
.topnav { display: flex; align-items: center; gap: 2px; height: var(--appbar-h); }
.topnav a { display: flex; align-items: center; gap: 7px; height: var(--appbar-h); padding: 0 12px; color: var(--text-2); font-weight: 500; position: relative; white-space: nowrap; }
.topnav a .icon { width: 17px; height: 17px; }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--text); font-weight: 600; }
.topnav a.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--teal); border-radius: 2px; }
.topnav .nav-sep { width: 1px; height: 22px; background: var(--border); margin: 0 8px; }
.nav-badge { font-size: 11px; font-weight: 700; background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; line-height: 17px; min-width: 17px; text-align: center; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; width: 240px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search-box input { padding-left: 34px; height: 38px; border-radius: 10px; background: var(--input-bg); }
.search-box kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--border-2); border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.page { padding: 28px 24px 48px; width: 100%; max-width: 1480px; margin: 0 auto; flex: 1; min-width: 0; overflow-x: clip; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 6px; font-size: 13.5px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 手機：底部分頁列 ＋ 「更多」底部面板 */
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--text-3); border: 0; background: none; padding: 4px 0 2px; position: relative; font-weight: 500; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--teal-deep); font-weight: 600; }
.tabbar .icon { width: 22px; height: 22px; }
.tabbar .tab-add .circle { width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: var(--lime); display: grid; place-items: center; margin-top: -22px; box-shadow: var(--shadow); border: 3px solid var(--surface); }
.tabbar .tab-add .circle .icon { width: 22px; height: 22px; stroke-width: 2.5; }
.tabbar .nav-badge { position: absolute; top: 0; left: calc(50% + 6px); }
.sidebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--surface); border-radius: 18px 18px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg); max-height: 85vh; overflow: auto; }
.sidebar.open { transform: none; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(18, 17, 14, 0.5); z-index: 65; display: none; }
.sidebar-overlay.show { display: block; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 0 auto 14px; }
.sheet-user { display: flex; align-items: center; gap: 12px; padding: 6px 4px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.sheet-user .name { font-weight: 600; }
.sheet-user .role { font-size: 12px; color: var(--text-3); }
.sheet-nav a, .sheet-nav button { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; color: var(--text); width: 100%; border: 0; background: none; font-size: 14.5px; text-align: left; }
.sheet-nav a:hover { text-decoration: none; background: var(--surface-2); }
.sheet-nav a.active { background: var(--teal-tint); color: var(--teal-deep); font-weight: 600; }
.sheet-nav .sep { border-top: 1px solid var(--border); margin: 6px 0; }
@media (min-width: 901px) { .sidebar, .sidebar-overlay { display: none !important; } }
@media (max-width: 1100px) { .search-box { width: 180px; } .search-box kbd { display: none; } .topnav a span { display: none; } .topnav a { padding: 0 10px; } }
@media (max-width: 900px) {
  :root { --appbar-h: 56px; }
  .topnav, .search-box, .appbar .new-project-btn { display: none; }
  .appbar-inner { padding: 0 14px; }
  .brand { border-right: 0; padding-right: 0; }
  .brand img { height: 32px; width: 32px; }
  .brand-co { display: none; }
  .brand-sys { font-size: 14.5px; }
  .tabbar { display: flex; }
  .page { padding: 18px 16px calc(86px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 22px; }
}

/* ---------- cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-h h2 { display: flex; align-items: center; gap: 8px; }
.card-h h2 .icon { color: var(--teal-deep); }
.card-b { padding: 18px; }
.card-b.pad-0 { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-2 > *, .grid-3 > *, .stack > * { min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 1024px) { .grid-detail { grid-template-columns: 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 統計帶（取代卡片式 KPI） ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; position: relative; box-shadow: var(--shadow-sm); }
.kpis::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad-brand); z-index: 1; }
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 22px 20px 16px; color: inherit; border-right: 1px solid var(--border); min-width: 0; transition: background 0.15s; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--surface-2); text-decoration: none; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .kpi-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.kpi .kpi-icon .icon { width: 15px; height: 15px; }
.kpi .kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .kpi-value.money { font-size: 22px; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-3); }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid var(--border); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(n+4) { border-bottom: 0; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 16px 14px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .kpi:nth-child(odd) { border-right: 1px solid var(--border); }
  .kpi:nth-child(n+4) { border-bottom: 1px solid var(--border); }
  .kpi:last-child { border-right: 0; border-bottom: 0; }
  .kpi .kpi-value { font-size: 26px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--input-bg); color: var(--text); font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary .icon { color: var(--lime); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); background: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn-soft { background: var(--teal-tint); border-color: transparent; color: var(--teal-deep); }
.btn-soft:hover { background: var(--teal-tint); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-xs { width: 26px; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.7s linear infinite; }
.btn.loading:not(.btn-primary):not(.btn-danger)::after { border-color: var(--border-2); border-top-color: var(--teal); }
[data-theme='dark'] .btn-primary.loading::after { border-color: rgba(18, 17, 14, 0.3); border-top-color: #12110e; }
.btn-block { width: 100%; }
.link { color: var(--link); font-weight: 500; font-size: 13px; white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font-weight: 500; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- chips / badges / tones ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; background: var(--gray-soft); color: var(--gray); vertical-align: middle; }
.chip .icon { width: 12px; height: 12px; }
.chip.lg { font-size: 13px; padding: 3px 11px; }
.chip.outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }
.chip.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-orange { background: var(--orange-soft); color: var(--orange); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-teal { background: var(--teal-soft); color: var(--teal-c); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-indigo { background: var(--indigo-soft); color: var(--indigo); }
.tone-purple { background: var(--purple-soft); color: var(--purple); }
.tone-lime { background: var(--lime-soft); color: var(--lime-c); }
.tone-gray { background: var(--gray-soft); color: var(--gray); }
.tone-slate { background: var(--slate-soft); color: var(--slate); }
.tag { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 5px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); line-height: 18px; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--red); color: #fff; }
.code { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); letter-spacing: 0.02em; }

/* 急迫度 */
.u-overdue { background: var(--red-soft); color: var(--red); }
.u-today { background: var(--orange-soft); color: var(--orange); }
.u-soon { background: var(--amber-soft); color: var(--amber); }
.u-week { background: var(--teal-soft); color: var(--teal-c); }
.u-later { background: var(--gray-soft); color: var(--gray); }
.u-done { background: var(--green-soft); color: var(--green); }

/* ---------- forms ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: 9px;
  background: var(--input-bg); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--primary-ring); }
.input[aria-invalid='true'] { border-color: var(--red); }
.select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23857f71' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select.sm, .input.sm { height: 32px; font-size: 13px; border-radius: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field > label .req { color: var(--red); }
.field .hint { font-size: 12px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }
.form-section { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-deep); margin: 8px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); grid-column: 1 / -1; }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--teal-deep); margin: 0; }
.check-group { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.pill-check { position: relative; }
.pill-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill-check span { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-2); font-size: 13px; color: var(--text-2); background: var(--input-bg); transition: all 0.15s; }
.pill-check input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 500; }
.pill-check input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button, .seg label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; color: var(--text-2); font-weight: 500; font-size: 13px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.seg button.on, .seg label.on, .seg button:hover { color: var(--text); }
.seg button.on, .seg label.on { background: var(--input-bg); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg input { display: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-2); position: relative; transition: background 0.2s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.switch input:checked + .track { background: var(--teal-deep); }
[data-theme='dark'] .switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-ring); }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.template-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.template-chips button { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-2); font-size: 12.5px; }
.template-chips button:hover { border-color: var(--teal); color: var(--teal-deep); background: var(--teal-tint); border-style: solid; }
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; }
.pw-meter { font-size: 12px; color: var(--text-3); }
.pw-meter.ok { color: var(--green); } .pw-meter.bad { color: var(--red); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); letter-spacing: 0.06em; text-transform: uppercase; }
.table th:first-child { border-top-left-radius: var(--radius-lg); } .table th:last-child { border-top-right-radius: var(--radius-lg); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; transition: background 0.12s; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-title { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table .tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.table.compact td { padding: 9px 12px; }

/* ---------- 時程列：日期磚 ---------- */
.ms-list { display: flex; flex-direction: column; }
.ms-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); transition: background 0.12s; }
.ms-row:last-child { border-bottom: 0; }
.ms-row:hover { background: var(--surface-2); }
.ms-row.done .ms-title { text-decoration: line-through; color: var(--text-3); }
.date-tile { width: 48px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; border: 1px solid var(--border-2); border-radius: 8px; background: var(--input-bg); overflow: hidden; line-height: 1.1; text-align: center; }
.date-tile .m { width: 100%; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 0 2px; background: var(--surface-3); color: var(--text-2); }
.date-tile .d { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; padding: 4px 0 0; font-variant-numeric: tabular-nums; }
.date-tile .w { font-size: 10px; color: var(--text-3); padding: 1px 0 4px; }
.date-tile.dt-overdue { border-color: var(--red); } .date-tile.dt-overdue .m { background: var(--red); color: #fff; } .date-tile.dt-overdue .d { color: var(--red); }
.date-tile.dt-today { border-color: var(--orange); } .date-tile.dt-today .m { background: var(--orange); color: #fff; } .date-tile.dt-today .d { color: var(--orange); }
.date-tile.dt-soon { border-color: var(--amber); } .date-tile.dt-soon .m { background: var(--amber); color: #fff; }
.date-tile.dt-week .m { background: var(--teal-deep); color: #fff; }
[data-theme='dark'] .date-tile.dt-week .m { background: var(--teal-soft); color: var(--teal-c); }
.date-tile.dt-done { opacity: 0.6; } .date-tile.dt-done .m { background: var(--green); color: #fff; }
.ms-main { min-width: 0; }
.ms-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-title a { color: inherit; }
.ms-sub { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ms-sub a { color: var(--text-2); }
.ms-sub a:hover { color: var(--teal-deep); }
.ms-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.ms-date { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ms-date b { color: var(--text); font-weight: 600; }
.ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; cursor: pointer; background: var(--input-bg); transition: all 0.15s; color: transparent; flex-shrink: 0; }
.ck:hover { border-color: var(--green); }
.ck .icon { width: 13px; height: 13px; stroke-width: 3; }
.ck.on { background: var(--green); border-color: var(--green); color: #fff; }
.ck.sm { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .ms-row { grid-template-columns: auto auto minmax(0, 1fr); padding: 10px 14px; gap: 10px; }
  .ms-right { grid-column: 3; flex-direction: row; justify-content: flex-start; align-items: center; margin-top: -4px; }
  .date-tile { width: 42px; } .date-tile .d { font-size: 16px; }
}
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--teal-deep); flex-shrink: 0; letter-spacing: 0; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.sm { width: 22px; height: 22px; font-size: 10.5px; }
.avatar-row { display: inline-flex; align-items: center; gap: 7px; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .icon { width: 36px; height: 36px; opacity: 0.45; margin-bottom: 8px; stroke-width: 1.5; }
.empty p { font-size: 13.5px; }
.empty .btn { margin-top: 14px; }
.section-list > li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.section-list > li:last-child { border-bottom: 0; }
.activity .act-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; margin-top: 1px; }
.activity .act-icon .icon { width: 14px; height: 14px; }
.activity .act-body { min-width: 0; flex: 1; font-size: 13px; color: var(--text-2); }
.activity .act-body b { color: var(--text); font-weight: 600; }
.activity .act-time { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.mini-project { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); color: inherit; }
.mini-project:hover { background: var(--surface-2); text-decoration: none; }
.mini-project:last-child { border-bottom: 0; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; border-radius: 999px; background: var(--teal-deep); transition: width 0.4s; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.cols { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; align-items: end; height: 120px; padding-top: 10px; }
.cols .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.cols .col i { display: block; width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: var(--teal-deep); min-height: 3px; transition: height 0.4s; }
.cols .col:first-child i { background: var(--grad-brand); }
.cols .col.zero i { background: var(--surface-3); }
.cols .col b { font-size: 12px; color: var(--text-2); }
.cols .col span { font-size: 10.5px; color: var(--text-3); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .cols .col span { font-size: 9px; } }

/* ---------- project detail ---------- */
.detail-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head .title-block { flex: 1; min-width: 260px; }
.detail-head h1 { font-size: 24px; margin: 6px 0 8px; }
.detail-head .meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12.5px; }
.back-link:hover { color: var(--teal-deep); text-decoration: none; }
.status-select { height: 34px; width: auto; min-width: 130px; font-weight: 600; padding-left: 12px; }
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; font-size: 13.5px; }
.dl dt { color: var(--text-3); } .dl dd { margin: 0; min-width: 0; word-break: break-word; }
.dl dd a { word-break: break-all; }
.desc { white-space: pre-wrap; line-height: 1.65; font-size: 13.5px; color: var(--text); }
.note { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: 0; }
.note.pinned { background: color-mix(in srgb, var(--amber-soft) 45%, var(--surface)); }
.note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--text-3); }
.note-head .who { font-weight: 600; color: var(--text); }
.note-head .tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.note:hover .tools { opacity: 1; }
.note-body { white-space: pre-wrap; line-height: 1.65; font-size: 13.5px; }
.note-form { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.note-form .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.timeline { padding: 6px 18px 14px; }
.timeline li { position: relative; padding: 8px 0 8px 22px; font-size: 13px; color: var(--text-2); }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); }
.timeline li:first-child::before { background: var(--teal); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 25px; bottom: -8px; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li b { color: var(--text); font-weight: 600; }
.timeline .t { font-size: 11.5px; color: var(--text-3); margin-left: 6px; }
.links-list a { display: inline-flex; align-items: center; gap: 5px; margin: 0 8px 6px 0; font-size: 13px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--grad-brand); border-radius: 999px; }
.done-list summary { padding: 10px 18px; cursor: pointer; color: var(--text-3); font-size: 12.5px; border-top: 1px solid var(--border); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar .select, .toolbar .input { width: auto; min-width: 130px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filter-chips button { height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--input-bg); color: var(--text-2); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.filter-chips button.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.filter-chips button:hover:not(.on) { border-color: var(--text-3); }
.count-pill { font-size: 12px; color: var(--text-3); font-weight: 500; }

/* ---------- project cards ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: transform 0.15s, box-shadow 0.15s; position: relative; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pcard .pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard h3 { font-size: 15px; line-height: 1.35; }
.pcard .pcard-client { color: var(--text-2); font-size: 13px; }
.pcard .pcard-next { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.pcard .pcard-foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12px; }
.pcard.priority-high { border-left: 3px solid var(--red); }

/* ---------- schedule groups ---------- */
.sched-group { margin-bottom: 18px; }
.sched-group > h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.sched-group > h2 .chip { font-weight: 600; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h1 { font-size: 24px; min-width: 150px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cal-wd { background: var(--surface-2); padding: 8px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: 0.06em; }
.cal-cell { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-cell.other { background: var(--surface-2); }
.cal-cell.other .cal-day { color: var(--text-3); }
.cal-cell.weekend .cal-day { color: var(--text-3); }
.cal-day { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 500; }
.cal-cell.today .cal-day { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.cal-pill { display: block; width: 100%; text-align: left; font-size: 11.5px; padding: 2px 7px; border-radius: 5px; border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; line-height: 1.5; font-weight: 500; }
.cal-pill.done { text-decoration: line-through; opacity: 0.6; }
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 6px; }
@media (max-width: 760px) {
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-pill { font-size: 0; height: 6px; padding: 0; border-radius: 3px; margin-top: 2px; }
  .cal-more { display: none; }
}
.cal-list { margin-top: 18px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(18, 17, 14, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade 0.15s ease-out; }
.modal-backdrop.closing { animation: fadeout 0.15s ease-in forwards; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop 0.2s ease-out; border: 1px solid var(--border); }
.modal.lg { max-width: 780px; } .modal.sm { max-width: 420px; }
.modal-h { padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-h h3 { font-size: 16px; }
.modal-b { padding: 22px; overflow: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.confirm-msg { font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 94vh; }
}

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; pointer-events: none; width: min(92vw, 420px); }
@media (max-width: 900px) { .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: var(--ink); color: #f7f3e8; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px); transition: all 0.25s; pointer-events: auto; border: 1px solid rgba(255, 255, 255, 0.08); }
.toast.show { opacity: 1; transform: none; }
.toast .icon { width: 18px; height: 18px; }
.toast-success .icon { color: #78dc28; } .toast-error .icon { color: #f3a097; } .toast-info .icon { color: #4fc8c6; }

/* ---------- popover (notifications / user menu) ---------- */
.pop-anchor { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 32px); max-height: 72vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 80; animation: pop 0.15s ease-out; }
.popover .pop-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.popover .pop-h h3 { font-size: 14px; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif:last-child { border-bottom: 0; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); margin-top: 7px; flex-shrink: 0; }
.notif.read .dot { background: transparent; }
.notif .n-title { font-weight: 600; font-size: 13.5px; }
.notif .n-body { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.notif .n-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.bell-btn { position: relative; }
.bell-btn .badge { position: absolute; top: 4px; right: 4px; font-size: 10px; min-width: 16px; height: 16px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 80; animation: pop 0.15s ease-out; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; border: 0; background: none; color: var(--text); font-size: 13.5px; text-align: left; }
.user-menu a:hover, .user-menu button:hover { background: var(--surface-3); text-decoration: none; }
.user-menu .sep { border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- settings ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { height: 40px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--teal); font-weight: 600; }
.channel { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 14px; background: var(--surface); }
.channel.on { border-color: var(--teal); }
.channel-h { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.channel-h h3 { font-size: 14.5px; flex: 1; }
.channel-h .desc { font-size: 12.5px; color: var(--text-3); }
.channel-body { margin-top: 12px; }
.channel-body .form-grid { margin-bottom: 0; }
.channel .help { font-size: 12.5px; color: var(--text-3); line-height: 1.6; margin-top: 4px; }
.channel .help a { font-weight: 500; }
.result-box { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.result-ok { color: var(--green); } .result-bad { color: var(--red); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--teal-tint); color: var(--text); font-size: 13px; line-height: 1.6; margin-bottom: 16px; border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent); }
.notice .icon { color: var(--teal-deep); margin-top: 2px; }
.notice.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); } .notice.warn .icon { color: var(--amber); }
.notice.danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); } .notice.danger .icon { color: var(--red); }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.hour-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.hour-grid .pill-check span { width: 100%; justify-content: center; padding: 0; height: 32px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .hour-grid { grid-template-columns: repeat(6, 1fr); } }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-2); }
.ics-box { display: flex; gap: 8px; align-items: center; }
.ics-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

/* ---------- skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-page { display: flex; flex-direction: column; gap: 14px; }
.skel-page .skel { height: 72px; }
.skel-page .skel.t { height: 28px; width: 40%; }

/* ---------- misc ---------- */
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border-2); border-radius: 5px; padding: 0 5px; background: var(--surface-2); color: var(--text-2); }
.priority-flag { color: var(--red); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.error-box { padding: 24px; text-align: center; color: var(--red); }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }
@media print {
  .appbar, .tabbar, .sidebar, .actions, .toolbar { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
