/* rico-style-components.css v1.0.0 · git@git_ai:Qlink-TP/qlink_theme.git · 產生檔，請勿手改 */

/* ───────────────────────── 6. 基礎 reset／排版 ───────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 手機：禁止整頁左右捲動（內部 .ctx 等橫向 scroller 自帶 overflow-x:auto 不受影響）。
   用 clip 而非 hidden，才不會破壞 position:sticky 標題列。 */
@media (max-width: 720px) { html, body { overflow-x: clip; } }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', 'PingFang TC', 'Microsoft JhengHei', Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background-color .2s ease, color .2s ease;
  min-height: 100vh;
}

h1 { font-size: var(--fs-xl);  font-weight: var(--fw-black); line-height: var(--lh-tight); letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg);  font-weight: var(--fw-bold);  line-height: var(--lh-snug);  letter-spacing: -.01em; }
h3 { font-size: var(--fs-md);  font-weight: var(--fw-bold);  line-height: var(--lh-snug); }

a { color: inherit; text-decoration: none; }

.muted  { color: var(--tx2); }
.faint  { color: var(--tx3); }

.label  { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--tx2);
          letter-spacing: .08em; text-transform: uppercase; }
.num    { font-variant-numeric: tabular-nums; }

/* ───────────────────────── 7. 卡片（標準＝識別色角落漸層）─────────────────────────
   每張卡可設 --acc（識別色）；.is-interactive 加上 hover 浮起 */
.card {
  position: relative; overflow: hidden; isolation: isolate;

  --acc: var(--accent);

  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: .85; transition: opacity .15s ease;
  background: radial-gradient(ellipse 90% 70% at top left, color-mix(in srgb, var(--acc) 16%, transparent), transparent 72%);
}
.card.is-interactive { cursor: pointer; }
.card.is-interactive:hover { border-color: var(--acc); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card.is-interactive:hover::before { opacity: 1; }
.card.is-flat::before { display: none; }       /* 不要漸層時 */
.card-2 { background: var(--card2); }

/* 卡片識別色（驅動漸層 + hover 邊框） */
.card-accent-green  { --acc: var(--green); }
.card-accent-red    { --acc: var(--red); }
.card-accent-amber  { --acc: var(--amber); }
.card-accent-orange { --acc: var(--orange); }
.card-accent-blue   { --acc: var(--blue); }

.card-accent-violet,
.card-accent-purple { --acc: var(--violet); }
.card-accent-cyan   { --acc: var(--cyan); }
.card-accent-teal   { --acc: var(--teal); }

/* KPI tile */
.kpi { display: flex; flex-direction: column; gap: var(--sp-1); }

.kpi .kpi-v { font-size: var(--fs-num); font-weight: var(--fw-black);
              line-height: var(--lh-tight); font-variant-numeric: tabular-nums; }
.kpi .kpi-l { font-size: var(--fs-xs); color: var(--tx2); font-weight: var(--fw-bold); }

/* ───────────────────────── 8. 按鈕 ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); line-height: 1;
  padding: 11px 18px; border-radius: var(--r-md);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: all .15s ease; font-family: inherit;
}
.btn:active { transform: translateY(1px); }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--shadow-md); }

.btn-secondary { background: var(--card2); color: var(--tx); border-color: var(--line2); }
.btn-secondary:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

.btn-ghost     { background: transparent; color: var(--tx2); }
.btn-ghost:hover { background: var(--card2); color: var(--tx); }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }

.btn-sm { font-size: var(--fs-xs); padding: 7px 12px; }
.btn-lg { font-size: var(--fs-base); padding: 14px 24px; }

/* ───────────────────────── 9. 徽章／晶片 ───────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: var(--fw-bold);
  padding: 4px 10px; border-radius: var(--r-full);
}
.badge-green  { color: var(--green);  background: var(--green-bg); }
.badge-red    { color: var(--red);    background: var(--red-bg); }
.badge-amber  { color: var(--amber);  background: var(--amber-bg); }
.badge-blue   { color: var(--blue);   background: var(--blue-bg); }
.badge-violet { color: var(--violet); background: var(--violet-bg); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--tx2);
  background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--r-full); padding: 7px 14px;
}

/* ───────────────────────── 10. 表單 ───────────────────────── */
.input, select.input {
  font-size: var(--fs-sm); font-family: inherit; color: var(--tx);
  background: var(--card2); border: 1px solid var(--line2);
  border-radius: var(--r-md); padding: 10px 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ───────────────────────── 11. 表格 ───────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }

.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-bold);
  color: var(--tx2); text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 14px; background: var(--card2); border-bottom: 1px solid var(--line2);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table tr:hover td { background: var(--card2); }

/* ───────────────────────── 12. 主題切換 ─────────────────────────
   切換瞬間暫時關閉全站過場 → 顏色即時換、不卡頓；旋鈕(.ts-thumb)例外，保留滑動 */
html.theme-switching *:not(.ts-thumb) { transition: none !important; }

/* 舊版圖示鈕（相容保留） */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--card2); border: 1px solid var(--line2);
  color: var(--tx2); cursor: pointer; font-size: 1.1rem; transition: all .15s;
}
.theme-toggle:hover { color: var(--tx); border-color: var(--accent); }

/* 滑動式深淺色開關 */
.theme-switch {
  position: relative; width: 62px; height: 32px; flex-shrink: 0;
  border-radius: var(--r-full); background: var(--card2);
  border: 1px solid var(--line2); cursor: pointer; padding: 0;
}
.theme-switch:hover { border-color: var(--accent); }

.theme-switch .ts-ico {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 13px; line-height: 1; opacity: .55;
}
.theme-switch .ts-ico.sun  { left: 9px; }
.theme-switch .ts-ico.moon { right: 9px; }

.theme-switch .ts-thumb {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--card); box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: transform .22s cubic-bezier(.34,1.4,.5,1);
}
.theme-switch .ts-thumb::before { content: '☀️'; }
html[data-theme="dark"] .theme-switch .ts-thumb { transform: translateX(30px); }
html[data-theme="dark"] .theme-switch .ts-thumb::before { content: '🌙'; }

/* ───────────────────────── 13. 應用頁首（dashboard header）───────────────────────── */
.app-header { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }

.app-header__icon {
  width: 48px; height: 48px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  border-radius: var(--r-md); background: var(--accent-bg); border: 1px solid var(--line2);
}
.app-header__titles { min-width: 0; }
.app-header__title { font-size: var(--fs-xl); font-weight: var(--fw-black); line-height: var(--lh-tight); letter-spacing: -.02em; color: var(--tx); }
.app-header__sub { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--tx3); letter-spacing: .02em; margin-top: 4px; }
.app-header__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* 頁首 pill 動作鈕 */
.hdr-btn {
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  background: var(--card2); border: 1px solid var(--line2); color: var(--tx2);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none; transition: all .15s;
}
.hdr-btn:hover { background: var(--card); border-color: var(--accent); color: var(--tx); }

/* ───────────────────────── 14. 面板 panel（標題容器）───────────────────────── */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: var(--sp-5); overflow: hidden; box-shadow: var(--shadow-sm); }
.panel-header { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); }
.panel-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--tx); letter-spacing: -.01em; }
.panel-body { padding: var(--sp-5); }

/* ───────────────────────── 15. 分頁 tabs（底線式）───────────────────────── */
.tabs-bar { display: flex; align-items: center; gap: var(--sp-1); border-bottom: 1px solid var(--line2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.tab-btn { padding: 10px 18px; border: none; background: none; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--tx2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; font-family: inherit; }
.tab-btn:hover { color: var(--tx); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ───────────────────────── 16. 資訊列 infobar（指標參考列）───────────────────────── */
.infobar { display: flex; align-items: center; gap: var(--sp-3) var(--sp-7); flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); box-shadow: var(--shadow-sm); }
.infobar__chip { font-weight: var(--fw-bold); color: var(--accent); font-size: var(--fs-sm); background: var(--accent-bg); border-radius: var(--r-full); padding: 6px 14px; }
.infobar__item { display: flex; flex-direction: column; gap: 2px; }
.infobar__label { color: var(--tx3); font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .02em; }
.infobar__value { font-weight: var(--fw-black); color: var(--tx); font-size: var(--fs-md); }

/* ───────────────────────── 17. 橫幅 banner（提示/警示）───────────────────────── */
.banner { border-radius: var(--r-md); padding: 11px 16px; font-size: var(--fs-sm); border: 1px solid; }
.banner-amber { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.banner-red   { background: var(--red-bg);   border-color: var(--red);   color: var(--red); }
.banner-blue  { background: var(--blue-bg);  border-color: var(--blue);  color: var(--blue); }
.banner-green { background: var(--green-bg); border-color: var(--green); color: var(--green); }

/* ───────────────────────── 18. Modal / 對話框 ───────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgb(0 0 0 / .45); display: flex; align-items: center; justify-content: center; }
.modal { position: relative; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r-lg); padding: var(--sp-6); width: min(720px, 92vw); max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.modal__title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--tx); }
.modal__close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--tx2); line-height: 1; padding: 4px 8px; }

/* ───────────────────────── 19. 行動裝置（標準斷點）───────────────────────── */
@media (max-width: 960px) {
  .card { padding: var(--sp-5); }
}

@media (max-width: 640px) {
  body { font-size: var(--fs-sm); }   /* 手機內文 15px，仍清晰 */
  .card { padding: var(--sp-4); border-radius: var(--r-md); }
  .btn  { padding: 10px 16px; }
  .hide-mobile { display: none !important; }
}
