:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #1f2937;
  background: #f3f5f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f3f5f7; color: #1f2937; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 16px 50px rgba(15, 23, 42, .10); }
h1, h2, h3 { margin-top: 0; }
h1 { font-size: 1.6rem; margin-bottom: 8px; }
h2 { font-size: 1.25rem; margin-bottom: 6px; }
h3 { font-size: 1rem; }
.muted { color: #6b7280; margin-top: 0; }


.login-role-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 22px;
  padding: 4px;
  border-radius: 12px;
  background: #edf1f4;
  overflow: hidden;
}
.login-role-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, .14);
  transition: transform .22s ease;
}
.login-role-switch.admin-selected .login-role-slider {
  transform: translateX(100%);
}
.login-role-option {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: #6b7280;
  padding: 10px 12px;
  border-radius: 9px;
  font-weight: 700;
  transition: color .2s ease;
}
.login-role-option.active { color: #1f5f8b; }
.login-role-option:focus-visible { outline: 2px solid rgba(31, 95, 139, .35); outline-offset: -2px; }

.stack { display: grid; gap: 16px; margin-top: 24px; }
label span { display: block; font-size: .92rem; margin-bottom: 7px; font-weight: 600; }
input { width: 100%; border: 1px solid #d1d5db; border-radius: 10px; padding: 11px 12px; background: white; color: #111827; }
input:focus { outline: 2px solid rgba(31, 95, 139, .18); border-color: #1f5f8b; }

.primary, .secondary, .danger-outline { border: 0; border-radius: 10px; padding: 10px 15px; font-weight: 700; }
.primary { background: #1f5f8b; color: #fff; }
.secondary { background: #e8eef3; color: #23445a; }
.danger-outline { background: #fff; color: #a83232; border: 1px solid #e3b4b4; }
.small { padding: 7px 10px; font-size: .9rem; }
.link-button { border: 0; background: transparent; color: #1f5f8b; padding: 12px 0 0; margin-top: 8px; }

.topbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 5; }
.topbar-user { color: #6b7280; font-size: .92rem; }
.container { width: min(1160px, calc(100% - 32px)); margin: 28px auto 56px; }
.container.narrow { width: min(760px, calc(100% - 32px)); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.full-width { grid-column: 1 / -1; }
.card { background: white; border: 1px solid #e5e7eb; border-radius: 16px; padding: 22px; box-shadow: 0 4px 18px rgba(15, 23, 42, .035); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 12px 0; }

.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: .85rem; font-weight: 800; white-space: nowrap; }
.badge.open { background: #e4f5ea; color: #1c6b38; }
.badge.closed { background: #eceff2; color: #59636e; }

.trip-list { display: grid; gap: 10px; margin-top: 18px; }
.trip-option { display: flex; align-items: center; gap: 12px; border: 1px solid #dfe5ea; border-radius: 12px; padding: 15px 14px; background: #fff; }
.trip-option:hover { border-color: #9fb5c4; }
.trip-option.disabled { background: #f7f7f7; color: #6b7280; }
.trip-option input { width: 20px; height: 20px; flex: 0 0 auto; }

.message { margin-top: 14px; padding: 10px 12px; border-radius: 9px; background: #eef3f7; color: #3d5565; }
.message.success { background: #e9f6ed; color: #24653a; }
.message.error { background: #fff0f0; color: #9d2b2b; }

.preview-box { margin: 14px 0 18px; padding: 13px 14px; background: #f7f9fb; border: 1px dashed #c7d1da; border-radius: 10px; font-size: .91rem; line-height: 1.75; }
.editor-list { display: grid; gap: 10px; }
.editor-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: center; }
.editor-row.user-row { grid-template-columns: 1fr 1fr auto; }
.row-actions { display: flex; gap: 7px; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 14px; }
.inline-form.two-inputs { grid-template-columns: 1fr 1fr auto; margin-bottom: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.stat-card { border: 1px solid #e0e5ea; border-radius: 12px; padding: 16px; }
.stat-card h3 { line-height: 1.45; margin-bottom: 12px; }
.stat-count { font-size: 1.45rem; font-weight: 800; color: #1f5f8b; margin-bottom: 8px; }
.name-list { color: #59636e; line-height: 1.65; word-break: break-word; }
.empty-state { padding: 24px; text-align: center; color: #6b7280; background: #f8fafb; border-radius: 10px; }
.empty-state.compact { padding: 14px; }

@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .editor-row, .editor-row.user-row, .inline-form, .inline-form.two-inputs { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-end; }
  .section-heading { flex-direction: column; }
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.language-control { display: flex; align-items: center; gap: 7px; color: #59636e; font-size: .88rem; font-weight: 600; }
.language-control span { display: inline; margin: 0; font-size: inherit; font-weight: 600; }
.language-control select { border: 1px solid #d1d5db; border-radius: 9px; padding: 7px 28px 7px 9px; background: #fff; color: #1f2937; font: inherit; }
.language-control select:focus { outline: 2px solid rgba(31, 95, 139, .18); border-color: #1f5f8b; }

@media (max-width: 620px) {
  .topbar { align-items: flex-start; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .language-control span { display: none; }
}
