:root {
  --primary: #ff6b6b;
  --primary-dark: #e55454;
  --accent: #ffc14d;
  --teal: #27c39f;
  --blue: #4a90e2;
  --purple: #9b59b6;
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #2d2a26;
  --muted: #7a7368;
  --border: #f1e8d8;
  --soft: #fff3e0;
  --shadow: 0 6px 24px rgba(255, 107, 107, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans TC', 'PingFang TC', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Top bar === */
.topbar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar a { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.25); display: grid; place-items: center; font-size: 18px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.3); }
.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.22); padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
}

/* === Layout === */
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-title { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 800; margin: 0 0 16px; }
.page-title .emoji { font-size: 28px; }
.page-sub { color: var(--muted); margin: -8px 0 18px; font-size: 14px; }

/* === Card === */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.card-title {
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === Stat tiles === */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile {
  border-radius: 16px;
  padding: 16px 18px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}
.stat-tile .label { font-size: 13px; opacity: .92; font-weight: 600; }
.stat-tile .value { font-size: 28px; font-weight: 800; margin-top: 4px; line-height: 1.2; }
.stat-tile .extra { font-size: 12px; opacity: .85; margin-top: 4px; }
.stat-tile .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 56px; opacity: .25; pointer-events: none; }
.stat-coral { background: linear-gradient(135deg, #ff6b6b, #ff8c5a); }
.stat-amber { background: linear-gradient(135deg, #ffc14d, #ff9d3c); }
.stat-teal  { background: linear-gradient(135deg, #27c39f, #20a98a); }
.stat-blue  { background: linear-gradient(135deg, #4a90e2, #2f6fc2); }
.stat-purple{ background: linear-gradient(135deg, #9b59b6, #7a4493); }
.stat-pink  { background: linear-gradient(135deg, #f06292, #ec407a); }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: none; cursor: pointer;
  font-weight: 700; font-size: 14px; transition: all .15s;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn.secondary { background: #f5e8d0; color: var(--ink); }
.btn.secondary:hover { background: #ecdcb8; }
.btn.outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn.outline:hover { background: var(--primary); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: #e74c3c; }
.btn.danger:hover { background: #c0392b; }
.btn.success { background: var(--teal); }
.btn.success:hover { background: #20a98a; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 16px; }
.btn.block { display: flex; width: 100%; justify-content: center; }

/* === Forms === */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=date], input[type=datetime-local], input[type=number], input[type=color],
input[type=month], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fffcf6;
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,107,.18);
}
textarea { resize: vertical; min-height: 80px; }

/* === Tables === */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table th { background: #fff7eb; font-weight: 700; color: var(--ink); position: sticky; top: 0; }
table.table tbody tr:hover { background: #fff8f0; }
table.table tbody tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--primary);
}
.badge.gray { background: #b0a89a; }
.badge.amber { background: var(--accent); color: #6a4d00; }
.badge.teal { background: var(--teal); }
.badge.blue { background: var(--blue); }
.badge.red { background: #e74c3c; }
.badge.outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }

/* === Flash === */
.flash-list { margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-weight: 600;
  background: #fff; border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
}
.flash.success { border-color: var(--teal); }
.flash.error { border-color: #e74c3c; }
.flash.warning { border-color: var(--accent); }

/* === Activity grid === */
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.activity-card {
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer; position: relative;
}
.activity-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(255,107,107,.15); }
.activity-card .cat-banner {
  height: 96px; display: grid; place-items: center; font-size: 56px;
  color: #fff;
}
.activity-card .body { padding: 14px; }
.activity-card .title { font-weight: 800; font-size: 16px; margin: 0 0 6px; }
.activity-card .meta { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.activity-card .footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--soft); border-top: 1px solid var(--border);
  font-size: 13px;
}
.activity-card .price-tag { font-weight: 800; color: var(--primary); }

/* === Login === */
.auth-bg {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff6b6b 0%, #ffc14d 60%, #4a90e2 100%);
  padding: 24px;
}
.auth-card {
  background: #fff; border-radius: 24px; padding: 36px 32px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.auth-title { text-align: center; margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 24px; }

/* === Misc === */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.section-divider { height: 1px; background: var(--border); margin: 14px 0; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .emoji { font-size: 48px; margin-bottom: 8px; }
.k-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.k-row:last-child { border-bottom: none; }
.k-row .k { color: var(--muted); }
.k-row .v { font-weight: 700; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar .grow { flex: 1; }
.qr-wrap { text-align: center; padding: 20px; }
.qr-wrap img { max-width: 320px; width: 100%; border: 6px solid #fff; border-radius: 16px; box-shadow: var(--shadow); }
.tourist-rows { display: flex; flex-direction: column; gap: 10px; }
.tourist-row {
  background: var(--soft); padding: 12px; border-radius: 12px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px;
  position: relative;
}
.tourist-row .row-num {
  position: absolute; top: 8px; right: 12px; background: var(--primary);
  color: #fff; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}

/* === Pagination etc === */
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; color: var(--ink); }

@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .nav { width: 100%; }
  .container { padding: 16px; }
  .stat-tile .icon { font-size: 40px; }
}
