:root {
  color-scheme: light;
  --ink: #162d35;
  --muted: #526871;
  --line: #dce6e6;
  --accent: #116a60;
  --accent-dark: #0b5048;
  --paper: #fff;
  --canvas: #f0f5f4;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; }
a { color: var(--accent-dark); }
button, input, select { font: inherit; }
label { font-weight: 650; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #38a693;
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 5vw, 2.55rem); line-height: 1.18; letter-spacing: -.04em; }
h2 { font-size: 1.22rem; }
p { line-height: 1.65; }

.topbar { background: #112f33; color: #fff; }
.bar-inner, .shell { width: min(1200px, calc(100% - 56px)); margin-inline: auto; }
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 18px; font-weight: 750; white-space: nowrap; }
.mark {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: #c9f3e5; background: #15655d; font: 750 14px system-ui, sans-serif; letter-spacing: .04em;
}
.brand-label { display: block; color: inherit; opacity: .76; font-size: 11px; font-weight: 500; margin-top: 2px; }
.account { display: flex; align-items: center; gap: 16px; font-size: .86rem; }
.account .quiet { background: transparent; color: #fff; border-color: #4e6d70; }
.account .quiet:hover { background: #23494e; }
.bot-handle { color: #cce4de; }
.shell { padding-block: 42px 60px; }
.heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.heading p { margin-top: 8px; color: var(--muted); }
.bot-status, .member-state {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  border-radius: 20px; color: #5b4a29; background: #f6ecd9; font-size: .81rem; white-space: nowrap;
}
.bot-status::before, .member-state::before { content: ""; display: block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bot-status.connected, .member-state.current { color: #136152; background: #dcf1e9; }
.panel, .login-card { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 8px 24px #173b3810; border-radius: 16px; }
.notice { padding: 12px 16px; background: #e0f3ec; color: #154e44; border-radius: 9px; margin-bottom: 16px; }
.notice.error { background: #fbeae7; color: #943c2f; }

.filters { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(115px, .52fr) minmax(210px, 1.45fr) auto; align-items: end; gap: 12px; padding: 20px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .login-form label { font-size: .85rem; }
input:not([type=hidden]), select {
  width: 100%; min-height: 42px; padding: 8px 11px; border-radius: 8px;
  border: 1px solid #cadbda; background: #fff; color: var(--ink);
}
input::placeholder { color: #61747b; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 7px 14px;
  background: #fff; color: var(--accent-dark); border: 1px solid #bbd4d0; border-radius: 8px;
  cursor: pointer; white-space: nowrap; font-weight: 650; font-size: .9rem; text-decoration: none;
}
.button:hover { background: #eaf5f2; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; min-height: 42px; }
.button.primary:hover { background: var(--accent-dark); }
.button.quiet { min-height: 34px; padding: 5px 11px; }
.button:disabled { opacity: .58; cursor: wait; }
.sync-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); background: #f7fbfa; }
.sync-bar p { margin-top: 4px; font-size: .86rem; color: var(--muted); }
.sync-bar .muted { margin-inline-start: 7px; }
.muted, .list-footer { color: var(--muted); }
.numeric, .person small { font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 700px; border-collapse: collapse; text-align: start; }
th, td { padding: 14px 12px; border-top: 1px solid var(--line); text-align: start; }
th { color: #3f575d; background: #f3f7f6; font-size: .79rem; font-weight: 750; white-space: nowrap; }
th:first-child, td:first-child { padding-inline-start: 20px; }
th:last-child, td:last-child { padding-inline-end: 20px; text-align: end; }
td { max-width: 275px; overflow-wrap: anywhere; }
tr:hover td { background: #f7fbfa; }
.person { display: flex; align-items: center; gap: 10px; min-width: 156px; }
.person strong, .person small { display: block; }
.person small { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.avatar { display: grid; place-items: center; position: relative; width: 40px; height: 40px; flex: 0 0 40px; overflow: hidden; border-radius: 50%; color: var(--accent-dark); background: #dbece8; font-weight: 800; }
.avatar img { position: absolute; inset: 0; object-fit: cover; }
.list-footer, .list-footer nav { display: flex; align-items: center; gap: 12px; }
.list-footer { padding: 13px 20px; border-top: 1px solid var(--line); justify-content: space-between; font-size: .85rem; }
.empty { text-align: center; padding: 45px 22px; border-top: 1px solid var(--line); }
.empty.first { padding-block: 56px; }
.empty h2 { margin-top: 9px; }
.empty p { color: var(--muted); max-width: 40em; margin: 8px auto 0; }

.edit-shell { max-width: 680px; }
.edit-shell .heading { margin-top: 16px; }
.back { font-weight: 650; text-decoration: none; }
.back:hover { text-decoration: underline; }
.edit-person { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.edit-form { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.wide { grid-column: 1 / -1; }
.actions { display: flex; justify-content: end; gap: 8px; margin-top: 22px; }
.login-wrap { display: grid; place-items: center; min-height: 100svh; padding: 24px; background: radial-gradient(at top right, #d1e9e2, var(--canvas) 58%); }
.login-card { width: min(100%, 420px); padding: clamp(22px, 6vw, 35px); }
.login-card .brand { margin-bottom: 26px; }
.login-card h1 { margin-bottom: 22px; font-size: 1.85rem; }
.login-form { display: grid; gap: 9px; }
.login-form .button { margin-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 690px) {
  .bar-inner, .shell { width: calc(100% - 32px); }
  .shell { padding-top: 26px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search { grid-column: 1 / -1; }
  .filters button { grid-column: 1 / -1; }
  .sync-bar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 430px) {
  .bot-handle { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .list-footer { align-items: start; flex-direction: column; }
}
