/* ============================================================================
   PopTek Biz — 自訂樣式
   淺色專業後台風格;Element Plus 僅提供基礎元件樣式,版面由此檔控制。
   分區:1.變數 2.基礎 3.骨架 4.側邊選單 5.頂部列 6.內容區
        7.KPI 卡片 8.圖表 9.清單/時間軸 10.看板 11.表格與表單微調
        12.登入頁 13.工具類 14.回應式
   ========================================================================== */

/* ---------------------------------------------------------------- 1. 變數 */
:root {
  --pt-primary: #2f6fed;
  --pt-primary-soft: #eaf1ff;
  --pt-bg: #f4f6fa;
  --pt-panel: #ffffff;
  --pt-border: #e5e8ef;
  --pt-text: #26303d;
  --pt-text-sub: #6b7686;
  --pt-text-mute: #98a2b3;
  --pt-sidebar-bg: #1f2733;
  --pt-sidebar-bg-sub: #182029;
  --pt-sidebar-text: #c3ccda;
  --pt-sidebar-active: #2f6fed;
  --pt-danger: #e5484d;
  --pt-danger-soft: #fdecec;
  --pt-warning: #f0932b;
  --pt-warning-soft: #fff4e5;
  --pt-success: #1f9c62;
  --pt-success-soft: #e8f7ef;
  --pt-radius: 10px;
  --pt-radius-sm: 6px;
  --pt-sidebar-w: 220px;
  --pt-sidebar-w-collapsed: 64px;
  --pt-topbar-h: 58px;
  --pt-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 16px -6px rgba(16, 24, 40, .08);
}

/* ---------------------------------------------------------------- 2. 基礎 */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--pt-text);
  background: var(--pt-bg);
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

a { color: var(--pt-primary); text-decoration: none; }

/* 首次載入骨架 */
.boot-splash {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--pt-text-sub);
}
.boot-splash__logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--pt-primary);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--pt-shadow);
}
.boot-splash__title { font-size: 17px; font-weight: 600; color: var(--pt-text); }
.boot-splash__desc { font-size: 13px; }

/* ---------------------------------------------------------------- 3. 骨架 */
.pt-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--pt-bg);
}

.pt-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pt-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 18px 20px 32px;
  overflow: visible;
}

/* ------------------------------------------------------------ 4. 側邊選單 */
.pt-aside {
  flex: 0 0 auto;
  width: var(--pt-sidebar-w);
  background: var(--pt-sidebar-bg);
  color: var(--pt-sidebar-text);
  transition: width .22s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pt-aside.is-collapsed { width: var(--pt-sidebar-w-collapsed); }

.pt-brand {
  height: var(--pt-topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.pt-brand__logo {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: var(--pt-primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pt-brand__text {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
}
.pt-aside.is-collapsed .pt-brand { justify-content: center; padding: 0; }
.pt-aside.is-collapsed .pt-brand__text { display: none; }

.pt-menu {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 24px;
  border-right: none;
  background: transparent !important;
}
.pt-menu .el-menu-item {
  color: var(--pt-sidebar-text);
  height: 44px;
  line-height: 44px;
}
.pt-menu .el-menu-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.pt-menu .el-menu-item.is-active {
  background: var(--pt-sidebar-active) !important;
  color: #fff !important;
}
.pt-menu.el-menu--collapse { width: var(--pt-sidebar-w-collapsed); }

/* 選單圖示佔位:離線包未附 Element Plus 圖示元件,改以 CSS 呈現 */
.pt-menu__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
/* 展開時:以小圓點代表選單 */
.pt-menu__mark::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5d6b7d;
  transition: background .15s ease, transform .15s ease;
}
.pt-menu .el-menu-item:hover .pt-menu__mark::before { background: #9fb0c6; }
.pt-menu .el-menu-item.is-active .pt-menu__mark::before { background: #fff; transform: scale(1.25); }

.pt-menu__mark-text { display: none; }
.pt-menu__label { vertical-align: middle; }

/* 收合時:改以選單名稱首字作為辨識 */
.pt-aside.is-collapsed .pt-menu__mark::before { display: none; }
.pt-aside.is-collapsed .pt-menu__mark-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: #e7edf6;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.pt-aside.is-collapsed .pt-menu .el-menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}
.pt-aside.is-collapsed .pt-menu .el-menu-item.is-active .pt-menu__mark-text {
  background: rgba(255, 255, 255, .26);
}

.pt-aside__foot {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 12px;
  color: #7c8798;
  border-top: 1px solid rgba(255, 255, 255, .07);
  white-space: nowrap;
  overflow: hidden;
}

/* -------------------------------------------------------------- 5. 頂部列 */
.pt-header {
  height: var(--pt-topbar-h);
  flex: 0 0 auto;
  background: var(--pt-panel);
  border-bottom: 1px solid var(--pt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.pt-header__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pt-header__title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.pt-header__crumb { font-size: 12px; color: var(--pt-text-mute); white-space: nowrap; }
.pt-header__right { display: flex; align-items: center; gap: 10px; }
.pt-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--pt-radius-sm);
  outline: none;
}
.pt-user:hover { background: var(--pt-bg); }
.pt-user__name { font-weight: 600; }
.pt-user__role { font-size: 12px; color: var(--pt-text-sub); }

/* -------------------------------------------------------------- 6. 內容區 */
.pt-page { max-width: 1560px; }
.pt-page__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pt-page__title { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.pt-page__desc { font-size: 12px; color: var(--pt-text-mute); }

.pt-card {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.pt-card--tight { padding: 12px 16px; }
.pt-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pt-card__title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pt-card__title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--pt-primary);
}
.pt-card__extra { font-size: 12px; color: var(--pt-text-mute); }

/* 篩選列 */
.pt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.pt-filters .el-input,
.pt-filters .el-select { width: 168px; }
.pt-filters .el-input.pt-w-lg { width: 240px; }
.pt-filters .el-date-editor { width: 168px; }
.pt-filters__grow { flex: 1 1 auto; }

.pt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ----------------------------------------------------------- 7. KPI 卡片 */
.pt-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.pt-kpi {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
}
.pt-kpi__icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--pt-primary-soft);
  color: var(--pt-primary);
}
/* 離線包未附圖示元件:KPI 圖示區以裝飾性圓形呈現 */
.pt-kpi__icon::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid currentColor;
  opacity: .85;
}
.pt-kpi__body { min-width: 0; }
.pt-mark { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--pt-primary-soft); color: var(--pt-primary); }
.pt-mark .el-icon { font-size: 20px; }
.pt-kpi__label {
  font-size: 12px;
  color: var(--pt-text-sub);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-kpi__value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-kpi__sub { font-size: 11px; color: var(--pt-text-mute); margin-top: 3px; }
.pt-kpi.is-danger .pt-kpi__value { color: var(--pt-danger); }
.pt-kpi.is-danger .pt-kpi__icon { background: var(--pt-danger-soft); color: var(--pt-danger); }
.pt-kpi.is-warning .pt-kpi__icon { background: var(--pt-warning-soft); color: var(--pt-warning); }
.pt-kpi.is-warning .pt-kpi__value { color: var(--pt-warning); }
.pt-kpi.is-success .pt-kpi__icon { background: var(--pt-success-soft); color: var(--pt-success); }
.pt-kpi.is-success .pt-kpi__value { color: var(--pt-success); }
.pt-kpi.is-danger-bg { border-color: #f6c9cb; background: #fffafa; }
/* Dashboard priority: task/asset health follows clients; financial totals stay after it. */
.pt-kpis .pt-kpi:nth-child(3) { order: 5; }
.pt-kpis .pt-kpi:nth-child(4) { order: 6; }
.pt-kpis .pt-kpi:nth-child(5) { order: 7; }
.pt-kpis .pt-kpi:nth-child(6) { order: 8; }
.pt-kpis .pt-kpi:nth-child(7) { order: 3; }
.pt-kpis .pt-kpi:nth-child(8) { order: 4; }
.pt-kpi.is-danger .pt-mark { background: var(--pt-danger-soft); color: var(--pt-danger); }
.pt-kpi.is-warning .pt-mark { background: var(--pt-warning-soft); color: var(--pt-warning); }
.pt-kpi.is-success .pt-mark { background: var(--pt-success-soft); color: var(--pt-success); }

/* --------------------------------------------------------------- 8. 圖表 */
.pt-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 4px;
}
.pt-chart {
  width: 100%;
  transition: opacity .15s ease;
}
.pt-chart--loading { opacity: .55; }

.pt-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}
.pt-list { max-height: 340px; overflow-y: auto; }
.pt-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--pt-radius-sm);
  border-bottom: 1px dashed var(--pt-border);
  cursor: pointer;
}
.pt-list__row:last-child { border-bottom: none; }
.pt-list__row:hover { background: var(--pt-bg); }
.pt-list__main { min-width: 0; }
.pt-list__title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-list__desc {
  font-size: 12px;
  color: var(--pt-text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pt-list__side { text-align: right; flex: 0 0 auto; }
.pt-list__amount { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------- 9. 清單 / 時間軸 */
.pt-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pt-detail-head__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pt-detail-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--pt-text-sub);
}
.pt-detail-head__meta b { color: var(--pt-text); font-weight: 600; }

.pt-progress-cell { min-width: 120px; }
.pt-progress-cell__text {
  font-size: 11px;
  color: var(--pt-text-sub);
  margin-top: 2px;
}

.pt-desc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0 20px;
}
.pt-desc__item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--pt-border);
  font-size: 13px;
}
.pt-desc__label {
  flex: 0 0 96px;
  color: var(--pt-text-sub);
}
.pt-desc__value { flex: 1 1 auto; min-width: 0; word-break: break-word; }

.pt-timeline__content {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  padding: 10px 12px;
}
.pt-timeline__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pt-timeline__time { font-size: 12px; color: var(--pt-text-mute); }
.pt-timeline__text { font-size: 13px; white-space: pre-wrap; }
.pt-timeline__meta { font-size: 12px; color: var(--pt-text-sub); margin-top: 6px; }

/* --------------------------------------------------------------- 10. 看板 */
.pt-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}
.pt-board__col {
  background: #eef1f6;
  border-radius: var(--pt-radius);
  padding: 10px;
  min-height: 220px;
}
.pt-board__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
}
.pt-board__card {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  padding: 10px 12px;
  margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.pt-board__card.is-overdue { border-left: 3px solid var(--pt-danger); }
.pt-board__title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  word-break: break-word;
}
.pt-board__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pt-board__meta {
  font-size: 12px;
  color: var(--pt-text-sub);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.pt-board__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------ 11. 表格與表單微調 */
.el-table .cell { word-break: break-word; }
.pt-table-link { color: var(--pt-primary); cursor: pointer; font-weight: 600; }
.pt-table-link:hover { text-decoration: underline; }
.pt-mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.pt-nowrap { white-space: nowrap; }
.pt-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-money--danger { color: var(--pt-danger); font-weight: 600; }

.pt-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.pt-form-grid--1 { grid-template-columns: minmax(0, 1fr); }

/* Forms stay readable when labels are long or the viewport is narrow. */
.pt-form-grid > *,
.pt-form-grid .el-form-item { min-width: 0; }
.pt-dialog .el-form-item { min-width: 0; }
.pt-dialog .el-form-item__label {
  white-space: normal;
  line-height: 1.35;
  height: auto;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.pt-dialog .el-form-item__content,
.pt-dialog .el-input,
.pt-dialog .el-select,
.pt-dialog .el-date-editor { min-width: 0; max-width: 100%; }
.pt-dialog .el-input__wrapper,
.pt-dialog .el-textarea__inner { max-width: 100%; }

/* Only searchable selects need overlap protection; ordinary selects keep
   Element Plus' native placeholder positioning. */
.pt-dialog .pt-filter-select .el-select__wrapper { min-width: 0; overflow: hidden; }
.pt-dialog .pt-filter-select .el-select__selection { min-width: 0; overflow: hidden; flex-wrap: nowrap; }
.pt-dialog .pt-filter-select .el-select__selected-item { min-width: 0; max-width: 100%; }
.pt-dialog .pt-filter-select .el-select__input-wrapper { min-width: 4px; max-width: 100%; }
.pt-dialog .pt-filter-select .el-select__input { min-width: 4px; max-width: 100%; }
.pt-dialog .pt-filter-select:not(.is-focused) .el-select__input-wrapper { width: 0; min-width: 0; overflow: hidden; }

.pt-items-table { margin-bottom: 10px; }
.pt-items-table .el-input { width: 100%; }
.pt-items-total {
  display: flex;
  justify-content: flex-end;
  gap: 22px;
  font-size: 13px;
  padding: 8px 4px 0;
  border-top: 1px solid var(--pt-border);
}
.pt-items-total b { font-size: 15px; }

.pt-days { font-weight: 600; font-variant-numeric: tabular-nums; }
.pt-days--expired { color: var(--pt-danger); }
.pt-days--danger { color: var(--pt-danger); }
.pt-days--warning { color: var(--pt-warning); }
.pt-days--ok { color: var(--pt-success); }

.pt-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.pt-stat {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  padding: 14px 16px;
  box-shadow: var(--pt-shadow);
}
.pt-stat__label { font-size: 12px; color: var(--pt-text-sub); margin-bottom: 6px; }
.pt-stat__value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pt-stat.is-danger .pt-stat__value { color: var(--pt-danger); }
.pt-stat.is-success .pt-stat__value { color: var(--pt-success); }
.pt-stat.is-warning .pt-stat__value { color: var(--pt-warning); }

.pt-dialog-items .el-form-item { margin-bottom: 12px; }

/* ------------------------------------------------------------- 12. 登入頁 */
.pt-login {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1000px 480px at 12% 18%, #e7efff 0%, transparent 62%),
    radial-gradient(900px 420px at 88% 82%, #e6f7f0 0%, transparent 60%),
    var(--pt-bg);
  padding: 24px;
}
.pt-login__box {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--pt-panel);
  border-radius: 16px;
  box-shadow: 0 18px 48px -18px rgba(16, 24, 40, .28);
  overflow: hidden;
  border: 1px solid var(--pt-border);
}
.pt-login__intro {
  padding: 30px 36px 26px;
  background: linear-gradient(160deg, #2f6fed 0%, #1b3f8f 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  gap: 14px;
}
.pt-login__logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
}
.pt-login__intro h1 { font-size: 22px; margin: 0; }
.pt-login__intro p { font-size: 13px; line-height: 1.8; margin: 0; color: #d8e3ff; }
.pt-login__features { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; list-style: none; font-size: 12px; color: #d8e3ff; line-height: 1.8; margin: 4px 0 0; padding: 0; }
.pt-login__form { width: 100%; box-sizing: border-box; padding: 32px 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.pt-login__form h2 { margin: 0 0 4px; font-size: 19px; }
.pt-login__hint { font-size: 12px; color: var(--pt-text-mute); margin: 0 0 20px; }
.pt-login__submit { width: 100%; }

/* ------------------------------------------------------------- 13. 工具類 */
.pt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-row--between { justify-content: space-between; }
.pt-col { display: flex; flex-direction: column; gap: 4px; }
.pt-gap-sm { gap: 6px; }
.pt-mt-sm { margin-top: 8px; }
.pt-mt { margin-top: 16px; }
.pt-mb { margin-bottom: 16px; }
.pt-mb-sm { margin-bottom: 8px; }
.pt-muted { color: var(--pt-text-sub); font-size: 12px; }
.pt-danger-text { color: var(--pt-danger); }
.pt-success-text { color: var(--pt-success); }
.pt-text-right { text-align: right; }
.pt-ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.pt-empty-box { padding: 18px 0; }
.pt-pre { white-space: pre-wrap; font-size: 13px; line-height: 1.7; margin: 0; }

/* ------------------------------------------------------------- 14. 回應式 */
@media (max-width: 760px) {
  .pt-login__box { grid-template-columns: 1fr; max-width: 480px; }
  .pt-login__intro { padding: 28px 28px 22px; }
  .pt-login__form { padding: 26px 28px 32px; }
}

@media (max-width: 900px) {
  .pt-main { padding: 14px 12px 26px; }
  .pt-form-grid { grid-template-columns: minmax(0, 1fr); }
  .pt-header__crumb { display: none; }
  .pt-board { grid-template-columns: repeat(4, minmax(220px, 1fr)); }
  .pt-desc__label { flex-basis: 78px; }
}

@media (max-width: 640px) {
  .pt-dialog.el-dialog { width: calc(100vw - 24px) !important; margin: 12px auto !important; }
  .pt-dialog .el-dialog__body { max-height: calc(100vh - 150px); overflow-y: auto; padding-left: 14px; padding-right: 14px; }
  .pt-dialog .el-form-item { display: block; margin-bottom: 14px; }
  .pt-dialog .el-form-item__label { width: auto !important; justify-content: flex-start; min-height: 24px; padding: 0 0 5px; }
  .pt-dialog .el-form-item__content { margin-left: 0 !important; }
  .pt-kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pt-kpi { min-height: 72px; padding: 12px; }
  .pt-kpi__value { font-size: 17px; }
  .pt-user__role { display: none; }
  .pt-filters .el-input,
  .pt-filters .el-select,
  .pt-filters .el-input.pt-w-lg { width: 100%; }
}

/* 捲軸美化 */
.pt-menu::-webkit-scrollbar,
.pt-list::-webkit-scrollbar,
.pt-board::-webkit-scrollbar { width: 7px; height: 7px; }
.pt-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 4px; }
.pt-list::-webkit-scrollbar-thumb,
.pt-board::-webkit-scrollbar-thumb { background: #ccd3de; border-radius: 4px; }

/* ------------------------------------------------- 15.SPA 版面補充(重寫版) */
/* 側邊選單:Element Plus 圖示 + 文字 */
.pt-menu .el-menu-item .el-icon { font-size: 17px; margin-right: 6px; }
.pt-aside.is-collapsed .pt-menu .el-menu-item .el-icon { margin-right: 0; }
.pt-menu__title { font-size: 14px; }

/* 圖示徽章(取代舊版的裝飾圓點) */
.pt-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 11px;
  font-size: 21px;
  color: var(--pt-primary);
  background: var(--pt-primary-soft);
}
.pt-kpi.is-danger .pt-mark { background: var(--pt-danger-soft); color: var(--pt-danger); }
.pt-kpi.is-warning .pt-mark { background: var(--pt-warning-soft); color: var(--pt-warning); }
.pt-kpi.is-success .pt-mark { background: var(--pt-success-soft); color: var(--pt-success); }

/* 表格內的小圖示按鈕 */
.pt-act { display: inline-flex; align-items: center; gap: 4px; }
.pt-act .el-button + .el-button { margin-left: 0; }

/* 卡片內的工具列與圖表盒 */
.pt-toolbar--right { justify-content: flex-end; }
.pt-chart-box {
  background: var(--pt-panel);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  padding: 12px 14px 4px;
}
.pt-chart-box__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pt-chart-box__hint { font-size: 12px; color: var(--pt-text-mute); font-weight: 400; }
.pt-chart__canvas { width: 100%; }
@media (max-width: 1100px) { .pt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .pt-kpis, .pt-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pt-kpi { padding: 12px; gap: 9px; }
  .pt-mark { width: 36px; height: 36px; flex-basis: 36px; font-size: 17px; }
  .pt-kpi__value { font-size: 17px; }
}
@media (max-width: 480px) {
  .pt-kpis, .pt-charts { grid-template-columns: minmax(0, 1fr); }
  .pt-kpi__value { font-size: 20px; }
}

/* 展開列的期款摘要 */
.pt-sub {
  padding: 10px 12px;
  background: #fafbfe;
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
}
.pt-sub__title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

/* 看板欄位標題色條 */
.pt-board__col-head--TODO { color: #6b7686; }
.pt-board__col-head--DOING { color: var(--pt-primary); }
.pt-board__col-head--BLOCKED { color: var(--pt-danger); }
.pt-board__col-head--DONE { color: var(--pt-success); }

/* 描述清單(明細頁) */
.pt-desc--1 { grid-template-columns: minmax(0, 1fr); }
.pt-desc__value--pre { white-space: pre-wrap; }

/* 統計小卡補充 */
.pt-stat--flat { box-shadow: none; background: #fafbfe; }
.pt-money--success { color: var(--pt-success); font-weight: 600; }
.pt-money--muted { color: var(--pt-text-sub); }
.pt-delta { font-size: 12px; }

/* 對話框內的表單:2 欄格線在窄螢幕自動變 1 欄(見第 14 節媒體查詢) */
.pt-dialog .el-dialog__body { padding-top: 10px; }
.pt-form-tip { font-size: 12px; color: var(--pt-text-mute); line-height: 1.7; }

/* 清單載入中 */
.pt-loading-box { min-height: 120px; }

/* 路由切換淡入 */
.pt-main { animation: pt-fade .18s ease; }
@keyframes pt-fade {
  from { opacity: .55; }
  to { opacity: 1; }
}

/* 版面補強:頂部列的收合鈕與內容最大寬度 */
.pt-header__icon-btn { font-size: 18px; }
.pt-page { width: 100%; }

/* 列印時隱藏側邊選單與頂部列 */
@media print {
  .pt-aside, .pt-header { display: none !important; }
  .pt-main { padding: 0; }
}

/* =====================================================================
 * 第 16 節:基礎設置頁
 * ===================================================================== */

/* 兩欄版面:左設定、右預覽;窄螢幕自動變單欄 */
.pt-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* 卡片內文區(設定表單用) */
.pt-card__body { padding: 18px 20px 4px; }
.pt-card__body .el-form-item:last-child { margin-bottom: 8px; }

/* 表單欄位下方的說明文字 */
.pt-hint {
  font-size: 12px;
  color: var(--pt-text-sub);
  line-height: 1.7;
  margin-top: 4px;
}
.pt-hint--inline { display: inline-block; margin: 0 0 0 8px; }

@media (max-width: 1100px) {
  .pt-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* =====================================================================
 * 第 17 節:客戶聯絡人
 * ===================================================================== */
.pt-contacts { width: 100%; }
.pt-contacts .el-table { width: 100%; }

/* 客戶詳情的分頁內容與卡片間距 */
.pt-card .pt-tabs > .el-tabs__header { margin-bottom: 12px; }

/* =====================================================================
 * 第 18 節:到期日倒數(專案的域名 / SSL / 服務器)
 * ===================================================================== */
.pt-expiry {
  margin-left: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.pt-expiry.is-soon { color: #e6a23c; font-weight: 600; }
.pt-expiry.is-expired { color: #f56c6c; font-weight: 600; }

/* =====================================================================
 * 第 19 節:到期提醒
 * ===================================================================== */
/* 提醒紀錄中「查看郵件內容」的預覽區 */
.pt-mail-preview {
  border: 1px solid #ebeef5;
  border-radius: 4px;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
  background: #fff;
}
.pt-mail-preview table { width: 100%; }
