﻿:root {
  --color-primary: #6b4fa0;
  --color-text: #222;
  --color-muted: #666;
  --color-bg: #faf9fc;
  --color-surface: #fff;
  --color-border: #e3dff0;
  --color-ok: #1f8a4c;
  --color-error: #c0392b;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

.site-header,
.site-footer {
  padding: 12px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  border-bottom: none;
  text-align: center;
  color: var(--color-muted);
}

.brand {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.brand span { font-weight: 400; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.muted { color: var(--color-muted); }
.ok { color: var(--color-ok); }
.error { color: var(--color-error); }

[hidden] { display: none !important; }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page > main {
  flex: 1;
  width: 100%;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.site-nav {
  flex-wrap: wrap;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 28px;
}

a,
.link-button {
  color: var(--color-primary);
}

.link-button {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.form-card {
  max-width: 420px;
  margin: 16px auto 0;
  padding: 24px;
}

.form-card h1 {
  margin: 0 0 16px;
  font-size: 1.5rem;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #8f88a8;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  /* 小於 16px 時 iOS Safari 會在聚焦時自動放大畫面 */
  font: inherit;
  font-size: 16px;
}

.field-hint {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.button {
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.form-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 16px 0 0;
}

.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
}

.notice-error {
  background: #fbeceb;
  color: #8f2a20;
}

.notice-ok {
  background: #e8f5ee;
  color: #176338;
}

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}

.detail-list dt { color: var(--color-muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }

.card-form { max-width: 420px; }

.card-action { max-width: 420px; }

.button-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.button-danger { background: var(--color-error); }

.button-row {
  display: flex;
  gap: 8px;
}

.step-list { padding-left: 20px; }

.qr {
  width: 200px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--color-border);
}

.qr svg { display: block; }

.secret-key {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--color-bg);
  overflow-wrap: anywhere;
  user-select: all;
}

.code-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
  font-family: ui-monospace, Consolas, monospace;
}

.record-list {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.record-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.record-list small {
  width: 100%;
  overflow-wrap: anywhere;
}

.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #8f88a8;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 16px;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.filter-form .field {
  flex: 1 1 200px;
  margin-bottom: 0;
}

.filter-form .button { width: auto; }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: var(--color-muted);
  font-weight: 600;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
