/* SCS_FACE 管理後台樣式 */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  font-size: 14px;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
  font-family: "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  color: #f9fafb;
  padding: 10px 20px;
}
.top-bar .brand { font-weight: 600; font-size: 1.05em; }
.top-bar .user-area { display: flex; align-items: center; gap: 16px; }
.top-bar .inline-form { display: inline; margin: 0; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 48px);
}

.side-nav {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  padding: 16px 0;
}
.side-nav ul { list-style: none; padding: 0; margin: 0; }
.side-nav a {
  display: block;
  padding: 10px 20px;
  color: #374151;
  border-left: 3px solid transparent;
}
.side-nav a:hover { background: #f9fafb; border-left-color: #2563eb; text-decoration: none; }

.content { padding: 24px; }
.page-header h2 { margin: 0 0 4px 0; }
.page-header .hint { color: #6b7280; margin: 0 0 16px 0; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 16px;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  font-size: 0.85em;
  color: #374151;
  gap: 4px;
}
.filter-bar input, .filter-bar select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-link {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
}
.btn-primary { background: #2563eb; color: #ffffff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-secondary { background: #ffffff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-link { background: transparent; color: #2563eb; border: none; padding: 4px 8px; }
.btn-link:hover { text-decoration: underline; }

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}
.kpi-label { color: #6b7280; font-size: 0.85em; }
.kpi-value { font-size: 1.8em; font-weight: 600; color: #1f2937; margin-top: 4px; }

/* Chart cards */
.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}
.chart-card h3 { margin: 0 0 12px 0; font-size: 1em; color: #374151; }

/* Tables */
.table-wrap {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  vertical-align: middle;
}
.data-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}
.data-table tbody tr:hover { background: #f9fafb; }
.data-table .empty { text-align: center; color: #9ca3af; padding: 24px; }

.thumb {
  max-width: 60px;
  max-height: 60px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.tag--ok { background: #dcfce7; color: #166534; }
.tag--fail { background: #fee2e2; color: #991b1b; }
.tag--pending { background: #fef3c7; color: #92400e; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}
.pagination button {
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}
.pagination button:disabled { color: #9ca3af; cursor: not-allowed; }

/* Messages */
.message {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  min-height: 1.5em;
}
.message--info { background: #e0f2fe; color: #075985; }
.message--success { background: #dcfce7; color: #166534; }
.message--error { background: #fee2e2; color: #991b1b; }

/* Login page */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #1e293b;
}
.login-card {
  background: #ffffff;
  padding: 32px;
  border-radius: 12px;
  width: 380px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.login-card h1 { margin: 0 0 4px 0; font-size: 1.4em; }
.login-card .subtitle { color: #6b7280; margin: 0 0 20px 0; font-size: 0.9em; }

/* Form */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; color: #374151; }
.form input, .form textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.form textarea { resize: vertical; }

/* Warning banner */
.warning-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #92400e;
}
.warning-banner ul { margin: 8px 0 0 20px; padding: 0; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.modal[hidden] {
  display: none;
}
.modal-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 24px;
  width: 480px;
  max-width: 90vw;
}
.modal-card h3 { margin: 0 0 12px 0; }
.modal-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.9em;
  color: #374151;
}
.modal-card select, .modal-card textarea {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
