/* 目標：給初學者的極簡、乾淨後台 UI（不靠任何框架） */

:root {
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --line: rgba(255, 255, 255, 0.12);
  --primary: #7c5cff;
  --danger: #ff4d6d;
  --ok: #37d67a;
  --warn: #ffb703;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% 0%, rgba(124, 92, 255, 0.35), transparent 60%),
    radial-gradient(900px 700px at 90% 10%, rgba(55, 214, 122, 0.22), transparent 55%),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", Arial,
    sans-serif;
  line-height: 1.5;
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(11, 16, 32, 0.6);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}

.title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar__email {
  font-size: 13px;
  color: var(--muted);
  margin-right: 4px;
}

/* 登入頁：置中卡片 */
.loginWrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.loginWrap .loginCard {
  width: 100%;
  max-width: 420px;
  margin-top: 0;
}

.loginPending {
  text-align: center;
  padding: 20px 0;
}
.loginPending p {
  margin: 0 0 8px;
  color: var(--text);
}
.loginPending__hint {
  font-size: 13px;
  color: var(--muted);
}

.card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--card), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card__title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.card__hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.chip {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form__grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 0.5fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

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

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

.input--sm,
.select--sm {
  padding: 8px 10px;
  border-radius: 10px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.textarea {
  resize: vertical;
}

.form__actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  border-color: rgba(124, 92, 255, 0.7);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.9), rgba(124, 92, 255, 0.65));
}

.btn--primary:hover {
  filter: brightness(1.03);
}

.btn--danger {
  border-color: rgba(255, 77, 109, 0.55);
  background: rgba(255, 77, 109, 0.12);
}

.btn--ghost {
  background: transparent;
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.status--ok {
  border-color: rgba(55, 214, 122, 0.4);
}
.status--warn {
  border-color: rgba(255, 183, 3, 0.5);
}
.status--danger {
  border-color: rgba(255, 77, 109, 0.45);
}

.tableWrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
  background: rgba(0, 0, 0, 0.14);
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.right {
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--warn);
}

.dot--ok {
  background: var(--ok);
}

.dot--muted {
  background: rgba(255, 255, 255, 0.35);
}

.rowActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.footer {
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 12px;
}

/* 小螢幕：把欄位疊起來 */
@media (max-width: 920px) {
  .form__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .form__grid {
    grid-template-columns: 1fr;
  }
  .topbar__inner {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar__actions {
    justify-content: flex-end;
  }
}

/* 簡單的切換按鈕（checkbox 美化） */
.field--toggle {
  align-items: flex-start;
  gap: 8px;
  padding-top: 2px;
}
.field--toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  position: relative;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  transition: left 160ms ease, background 160ms ease;
}
#inputIsActive:checked + .toggle {
  border-color: rgba(55, 214, 122, 0.55);
  background: rgba(55, 214, 122, 0.12);
}
#inputIsActive:checked + .toggle::after {
  left: 20px;
  background: rgba(55, 214, 122, 0.95);
}
