:root {
  --navy: #1b2a4a;
  --paper: #f5edd8;
  --card: #fdf8ee;
  --line: #decda9;
  --gold: #c9a84c;
  --orange: #e07b39;
  --ink: #243044;
  --muted: #647084;
  --success: #2d6a4f;
  --danger: #b91c1c;
  color-scheme: light;
  font-family: "Noto Serif TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(201, 168, 76, 0.22), transparent 26rem),
    linear-gradient(135deg, #efe3c6 0%, var(--paper) 52%, #edf4f5 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 28px;
  background: var(--navy);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--orange);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand h1,
.topbar h2,
.section-header h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-item,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.nav-item {
  padding: 13px 16px;
  background: transparent;
  color: rgba(245, 237, 216, 0.72);
  text-align: left;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 4px 0 0 var(--gold);
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.security-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.security-card h2,
.security-card p {
  margin: 0;
}

.security-card p:last-child {
  margin-top: 8px;
  color: rgba(245, 237, 216, 0.76);
  line-height: 1.7;
}

.content {
  padding: 28px;
}

.topbar,
.connection-panel,
.toolbar,
.table-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(253, 248, 238, 0.88);
  box-shadow: 0 16px 36px rgba(27, 42, 74, 0.08);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px;
}

.connection-panel,
.toolbar {
  margin-top: 18px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fffaf0;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(224, 123, 57, 0.16);
}

.toolbar {
  grid-template-columns: minmax(260px, 1fr) 180px auto;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  background: var(--orange);
  color: #fff;
}

.ghost-button {
  min-height: 40px;
  padding: 0 16px;
  background: #fff7e6;
  color: var(--navy);
  border: 1px solid var(--line);
}

.message {
  min-height: 24px;
  margin: 14px 4px;
  color: var(--danger);
  font-weight: 700;
}

.message.ok {
  color: var(--success);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.table-card,
.detail-card {
  min-width: 0;
  padding: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.count-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(222, 205, 169, 0.75);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(224, 123, 57, 0.08);
}

.member-cell {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--navy);
  color: var(--gold);
  font-weight: 900;
}

.member-name {
  font-weight: 900;
}

.member-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty-cell,
.empty-detail {
  padding: 44px 12px;
  color: var(--muted);
  text-align: center;
}

.detail-stack {
  display: grid;
  gap: 16px;
}

.detail-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.detail-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 20px;
}

.detail-row,
.stats-grid,
.switch-grid {
  display: grid;
  gap: 10px;
}

.detail-row {
  grid-template-columns: 112px minmax(0, 1fr);
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.detail-row span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.stats-grid {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  padding: 14px;
  border-radius: 16px;
  background: #fff7e6;
  border: 1px solid var(--line);
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 24px;
}

.switch-grid {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 980px) {
  .app-shell,
  .layout-grid,
  .connection-panel,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}
