/* ── 基礎重置 ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Segoe UI', sans-serif; font-size: 14px; color: #1e293b; background: #f1f5f9; }

/* ── 登入頁 ───────────────────────────────── */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.1); padding: 40px; width: 100%; max-width: 440px; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 24px; color: #4f46e5; }
.auth-card h2 { font-size: 16px; margin-bottom: 16px; }
.auth-card label { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin: 12px 0 4px; }
.auth-card input { width: 100%; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 12px; font-size: 14px; outline: none; transition: border .2s; }
.auth-card input:focus { border-color: #4f46e5; }
.auth-card button[type=submit] { margin-top: 20px; width: 100%; background: #4f46e5; color: #fff; border: none; border-radius: 8px; padding: 10px; font-size: 14px; cursor: pointer; }
.auth-card button[type=submit]:disabled { opacity: .6; cursor: default; }
.tab-group { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-group button { flex: 1; padding: 8px; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; background: #f8fafc; font-size: 13px; }
.tab-group button.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.link { margin-top: 12px; color: #4f46e5; cursor: pointer; font-size: 13px; text-align: right; }
.error   { color: #ef4444; margin-top: 8px; font-size: 13px; }
.success { color: #22c55e; margin-top: 8px; font-size: 13px; }

/* ── 主框架 ───────────────────────────────── */
.app-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

/* ── 側邊欄 ───────────────────────────────── */
.sidebar { background: #1e1b4b; color: #c7d2fe; display: flex; flex-direction: column; padding: 0; }
.brand { padding: 20px 20px 12px; font-weight: 700; font-size: 15px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.user-info { padding: 12px 20px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid rgba(255,255,255,.1); }
.role-badge { font-size: 11px; background: rgba(255,255,255,.15); padding: 2px 6px; border-radius: 4px; width: fit-content; }
.sidebar ul { list-style: none; padding: 8px 0; flex: 1; }
.sidebar li { padding: 10px 20px; cursor: pointer; border-radius: 0; transition: background .15s; font-size: 13px; }
.sidebar li:hover { background: rgba(255,255,255,.08); }
.sidebar li.active { background: #4f46e5; color: #fff; }
.logout-btn { margin: 12px; border: none; background: rgba(255,255,255,.1); color: #c7d2fe; border-radius: 6px; padding: 8px; cursor: pointer; font-size: 13px; }
.logout-btn:hover { background: rgba(255,255,255,.2); }

/* ── 主內容 ───────────────────────────────── */
.main-content { padding: 28px 32px; overflow-y: auto; }
.page-title { font-size: 20px; font-weight: 700; color: #1e293b; margin-bottom: 20px; }

/* ── 總覽卡片 ─────────────────────────────── */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.card { background: #fff; border-radius: 10px; padding: 20px 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card-label { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.card-value { font-size: 26px; font-weight: 700; color: #4f46e5; }

/* ── 工具列 ───────────────────────────────── */
.toolbar { margin-bottom: 12px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar input, .filter-bar select {
  border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 10px; font-size: 13px; background: #fff; }

/* ── 表格 ─────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.data-table th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 12px; color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }
.text-right { text-align: right; }
.row-disabled td { color: #94a3b8; }

/* ── 狀態 Badge ───────────────────────────── */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-green  { background: #dcfce7; color: #15803d; }

/* ── 按鈕 ─────────────────────────────────── */
.btn-primary  { background: #4f46e5; color: #fff; border: none; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; }
.btn-secondary { background: #f1f5f9; color: #1e293b; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; }
.btn-sm       { padding: 4px 10px; font-size: 12px; border: none; border-radius: 4px; cursor: pointer; margin: 0 2px; }
.btn-success  { background: #22c55e; color: #fff; }
.btn-danger   { background: #ef4444; color: #fff; }

/* ── 分頁 ─────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: #64748b; }
.pagination button { padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 4px; cursor: pointer; background: #fff; font-size: 12px; }
.pagination button:disabled { opacity: .5; cursor: default; }

/* ── 其他 ─────────────────────────────────── */
.empty { color: #94a3b8; padding: 40px 0; text-align: center; }
.upload-area { background: #fff; border-radius: 10px; padding: 24px; max-width: 600px; }
.upload-area p  { color: #64748b; font-size: 13px; margin-bottom: 12px; }
.upload-area input[type=file] { display: block; margin: 12px 0; }
.result-box { background: #1e293b; color: #a3e635; padding: 16px; border-radius: 8px; font-size: 12px; margin-top: 16px; overflow: auto; max-height: 300px; }
code { background: #f1f5f9; padding: 1px 4px; border-radius: 3px; }

/* ── 響應式 ───────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 16px; }
}
