/* ZTranslation Dashboard — minimal Apple-flavored UI */

:root {
  --bg:        #0a0a0c;
  --surface:  #1c1c1e;
  --surface-2: #2c2c2e;
  --text:      #f5f5f7;
  --text-muted: #98989f;
  --border:   #38383a;
  --accent:   #AEC4C9;
  --accent-dim: rgba(174, 196, 201, 0.15);
  --crash:    #ff6b6b;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f5f5f7;
    --surface:   #ffffff;
    --surface-2: #f2f2f7;
    --text:      #1d1d1f;
    --text-muted: #6e6e73;
    --border:    #d2d2d7;
    --accent:    #274857;
    --accent-dim: rgba(39, 72, 87, 0.12);
    --crash:     #d92626;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang TC", system-ui;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.hdr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.hdr h1 { font-size: 18px; margin: 0; font-weight: 600; }
.hdr-controls { display: flex; gap: 16px; align-items: center; }
.hdr-controls label { font-size: 13px; color: var(--text-muted); }
.hdr-controls select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  margin-left: 6px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 28px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.card h2 { font-size: 16px; margin: 0 0 16px; font-weight: 600; }

.row { display: flex; gap: 24px; }
.row .half { flex: 1; }
.row-4 { flex-wrap: wrap; }
.row-4 .quarter { flex: 1 1 220px; min-width: 220px; }
@media (max-width: 800px) { .row { flex-direction: column; gap: 0; } }

/* Doughnut chart 寬度限制(Chart.js 沒設 maintainAspectRatio + 1:1 比例會把
   container 撐到 viewport 寬度,doughnut 變超大圓圈)*/
.chart-doughnut-wrap { max-width: 280px; margin: 0 auto; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.tbl th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.tbl tr:last-child td { border-bottom: none; }

/* 動作名稱欄(中文短 label 如「整頁翻譯(替換)」)強制單行,不要被旁邊 engine UUID
   擠到斷成兩列。次數欄同理(永遠數字、不應該換行)。 */
.tbl td.col-action,
.tbl td.col-count { white-space: nowrap; }

/* engine UUID(自訂引擎的 0c7b8163-2119-489f-9030-be1efc8ae3cd)寬度太長,允許
   在任意字元斷開、不要把整欄撐到爆,讓動作名稱欄能搶回單行空間。 */
.tbl td.col-engine { word-break: break-all; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }

.ftr {
  text-align: center;
  padding: 32px 24px 48px;
}
