:root {
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #1e293b;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; }
.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  background: #10243a;
  color: #fff;
}
.brand { color: #fff; font-size: 17px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.topbar nav, .account-tools { display: flex; align-items: center; gap: 18px; }
.topbar nav { flex: 1; }
.topbar a { color: #d9e6f5; text-decoration: none; }
.topbar a:hover { color: #fff; }
.account-tools { font-size: 13px; }
.account-tools form { margin: 0; }
.account-tools button { padding: 6px; border: 0; background: transparent; color: #e2e8f0; cursor: pointer; }
.page { max-width: 1200px; margin: 42px auto; padding: 0 24px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.page-heading h1, .welcome h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: #64748b; font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.panel, .login-card {
  margin: 0 0 20px;
  padding: 24px;
  border: 1px solid #e4e9f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 20px #14263a08;
}
.panel h2 { margin: 0 0 18px; font-size: 17px; }
.login-card { max-width: 420px; margin: 8vh auto; padding: 34px; }
.login-card h1 { margin: 0 0 28px; font-size: 23px; }
.login-card form, .panel form:not(.inline-action) { display: grid; gap: 16px; }
.login-card label, .panel label { display: grid; gap: 7px; color: #475569; font-size: 13px; }
.login-card input, .panel input:not([type=checkbox]), .panel select, .search-bar input {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  font: inherit;
}
.primary {
  padding: 10px 16px;
  border: 0;
  border-radius: 7px;
  background: #126a68;
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
.primary:hover, .inline-action button.primary:hover { background: #0e5856; }
.inline-form { grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; align-items: end; }
.inline-form select { min-height: 40px; }
.inline-form select[multiple] { height: 72px; }
.search-bar { display: flex !important; grid-template-columns: 1fr auto; gap: 10px !important; }
.search-bar input { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { background: #f8fafc; color: #64748b; font-weight: 650; }
th, td { padding: 13px 12px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.inline-action { display: inline; }
.inline-action button { padding: 6px 9px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; cursor: pointer; }
.inline-action button.primary { border-color: #126a68; background: #126a68; color: #fff; }
.tag { display: inline-block; margin-left: 8px; padding: 3px 8px; border-radius: 999px; background: #e6f5f2; color: #11645f; font-size: 11px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 10px; }
.panel .check { display: flex; align-items: center; gap: 8px; }
.narrow { max-width: 560px; }
.narrow form p { display: grid; gap: 6px; }
.narrow input { padding: 9px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.welcome { max-width: 720px; }
.card-link { display: flex; justify-content: space-between; margin-top: 12px; padding: 18px 20px; border: 1px solid #e4e9f0; border-radius: 10px; background: #fff; color: #1e293b; text-decoration: none; }
.card-link span { color: #126a68; }
.notice { padding: 12px 16px; border-radius: 8px; background: #e8f5ef; color: #1b6951; }
.error { color: #b42318; }
.muted { color: #64748b; }
details { padding: 13px 0; border-bottom: 1px solid #edf0f4; }
summary { cursor: pointer; font-weight: 600; }
code { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 850px) {
  .topbar { min-height: 64px; flex-wrap: wrap; gap: 12px; padding: 12px 20px; }
  .topbar nav { order: 3; flex-basis: 100%; overflow: auto; }
  .account-tools { margin-left: auto; gap: 4px; }
  .page { margin: 24px auto; padding: 0 16px; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .inline-form { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 25px; }
  .account-tools span { display: none; }
}
