:root {
  --bg: #f3efe6;
  --card: #fffdf9;
  --ink: #1c1915;
  --muted: #6d645b;
  --line: #e4d9c8;
  --forest: #1c332b;
  --forest-2: #27483c;
  --lime: #d6f26a;
  --cinnabar: #c2410c;
  --ok: #1f7a4d;
  --ok-bg: #e7f6ee;
  --warn: #92400e;
  --warn-bg: #fbf1dc;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --info: #1d4e89;
  --info-bg: #e7f0fb;
  --shadow: 0 12px 32px rgba(48, 34, 16, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans TC", "PingFang HK", "Droid Sans Fallback", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 0% -10%, rgba(214, 242, 106, 0.28), transparent 55%),
    var(--bg);
  font-size: 15px;
  line-height: 1.55;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--forest);
  font-weight: 700;
  border-radius: 11px;
  flex: none;
}

.auth { min-height: 100vh; }
.auth-shell {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 0.95fr);
  min-height: 100vh;
}
.auth-brand {
  background: var(--forest);
  color: #f6f3ec;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; }
.auth-brand h1 {
  font-size: 42px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 12em;
}
.auth-brand .intro { max-width: 28em; color: rgba(246, 243, 236, 0.78); font-size: 16px; }
.feature-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e7ff9a;
  font-weight: 600;
}
.feature-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--lime);
}
.auth-panel { padding: 48px 40px; display: flex; align-items: center; }
.auth-card { width: min(440px, 100%); margin: 0 auto; }
.tabs { display: flex; gap: 6px; background: rgba(255,255,255,.65); padding: 4px; border-radius: 999px; border: 1px solid var(--line); margin-bottom: 22px; }
.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 8px;
  color: var(--muted);
  font-weight: 600;
}
.tabs button.is-active { background: var(--forest); color: #fff; }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.stack { display: grid; gap: 12px; margin-top: 18px; }
.demo {
  margin-top: 22px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.demo p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.demo dl { display: grid; grid-template-columns: 52px 1fr; gap: 4px 8px; margin: 0; }
.demo dt { color: var(--muted); }
.demo dd { margin: 0; font-weight: 600; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px;
  flex: none;
  background: var(--forest);
  color: #f4f1ea;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 4px 8px 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 18px; }
.brand-text small { color: rgba(244, 241, 234, 0.62); font-size: 12px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a {
  text-decoration: none;
  color: rgba(255,255,255,.78);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(214, 242, 106, .16); color: #e7ff9a; }
.side-user {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 8px 4px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--forest-2);
  color: var(--lime);
  font-weight: 700;
}
.side-user strong { display: block; font-size: 14px; }
.side-user small { color: rgba(244,241,234,.62); }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  position: sticky;
  top: 0;
  background: rgba(243, 239, 230, .9);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.topbar h1 { font-size: 22px; letter-spacing: -0.02em; }
.topbar-meta { margin-left: auto; color: var(--muted); }
.nav-toggle { display: none; }
.content { padding: 8px 32px 64px; max-width: 1120px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 8px 0 18px;
}
.lede { color: var(--muted); max-width: 46em; }
.btn-row, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.2;
}
.btn:hover { border-color: #c9bba6; }
.btn-primary { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff; }
.btn-primary:hover { background: #9a3412; }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f0c2be; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { padding: 16px 18px 14px; }
.stat p { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 4px; font-size: 30px; letter-spacing: -0.04em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.grid-2 + .grid-2, .card + .card, .grid-2 + .card, .card + .grid-2 { margin-top: 14px; }
.card { padding: 16px 16px 8px; }
.card.pad { padding-bottom: 16px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.section-gap { margin-top: 14px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 700; }
tr.is-today td { background: #fbf6e8; }
tbody tr:hover td { background: #fbfaf6; }
.table-link { font-weight: 700; text-decoration: none; }
.table-link:hover { color: var(--cinnabar); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #f3efe6;
  color: var(--ink);
  white-space: nowrap;
}
.badge-active, .badge-completed, .badge-purchase, .badge-refund { background: var(--ok-bg); color: var(--ok); }
.badge-scheduled, .badge-adjust { background: var(--info-bg); color: var(--info); }
.badge-expired, .badge-no_show, .badge-deduct { background: var(--warn-bg); color: var(--warn); }
.badge-depleted, .badge-inactive { background: #f1eee8; color: #5c564e; }
.badge-cancelled, .badge-cancel { background: var(--bad-bg); color: var(--bad); }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--bad-bg); color: var(--bad); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 160px; }
.narrow { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 14px; }
.hint, .muted { color: var(--muted); }
.hint { font-size: 13px; font-weight: 400; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(194, 65, 12, .25);
  border-color: #e0a48c;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: auto; }

.pkg-list { display: grid; gap: 10px; }
.pkg-link { text-decoration: none; display: block; }
.pkg {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.pkg-link:hover .pkg { border-color: #e0a48c; }
.pkg-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pkg-remain { margin: 8px 0 6px; display: flex; align-items: baseline; gap: 8px; }
.pkg-remain b { font-size: 32px; letter-spacing: -0.04em; line-height: 1; }
.progress { height: 8px; background: #efe8dc; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--forest); border-radius: inherit; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.delta.pos { color: var(--ok); }
.delta.neg { color: var(--bad); }
.empty { padding: 22px 8px 28px; color: var(--muted); }
.pager { display: flex; gap: 6px; margin-top: 14px; }
.pager a {
  text-decoration: none;
  min-width: 34px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.pager a.current { background: var(--forest); color: #fff; border-color: var(--forest); }
.follow { display: grid; gap: 2px; text-decoration: none; padding: 10px 0; border-bottom: 1px solid var(--line); }
.follow strong { font-size: 15px; }
.follow em { font-style: normal; color: var(--muted); font-size: 13px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.person-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person-title h2 { font-size: 28px; letter-spacing: -0.03em; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 22px; }
  .auth-brand h1 { font-size: 32px; }
  .auth-panel { padding: 22px 16px 40px; }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed;
    z-index: 20;
    transform: translateX(-105%);
    transition: transform .2s ease;
    height: 100%;
  }
  .sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .topbar-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
