:root {
  color: #151922;
  background: #f4f6f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  --surface: #ffffff;
  --line: #e3e7ed;
  --muted: #687386;
  --primary: #2f6fed;
  --primary-dark: #2158c5;
  --danger: #c93646;
  --success: #1f8a58;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: #f4f6f9; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 36px; box-shadow: 0 16px 40px rgba(25, 35, 50, .08); }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: white; background: #171c26; font-weight: 750; font-size: 22px; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 6px; font-size: 15px; }
.login-panel h1 { margin: 22px 0 6px; font-size: 24px; }
.login-panel p { margin: 0 0 28px; color: var(--muted); }
label { display: flex; flex-direction: column; gap: 7px; color: #3d4655; font-weight: 600; }
input, select { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #cfd5df; border-radius: 6px; background: white; color: #171c26; outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.login-panel label + label { margin-top: 16px; }
button { min-height: 36px; border: 1px solid #ccd3de; border-radius: 6px; padding: 0 14px; background: white; color: #222936; }
button:hover { background: #f6f8fb; }
button.primary { border-color: var(--primary); background: var(--primary); color: white; font-weight: 650; }
button.primary:hover { background: var(--primary-dark); }
button.danger { border-color: #efc9ce; color: var(--danger); }
.full { width: 100%; margin-top: 24px; }
.form-error { min-height: 20px; margin-top: 12px; color: var(--danger); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: #171c26; color: white; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-size: 17px; font-weight: 700; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav button { border: 0; color: #aeb7c7; background: transparent; text-align: left; padding: 0 12px; height: 40px; }
.sidebar nav button:hover { color: white; background: #222937; }
.sidebar nav button.active { color: white; background: #2b3444; font-weight: 650; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #303847; padding: 16px 10px 0; display: grid; gap: 8px; color: #aeb7c7; overflow-wrap: anywhere; }
.text-button { border: 0; padding: 0; min-height: auto; width: fit-content; color: #dbe1ea; background: transparent; }
.main { min-width: 0; padding: 0 32px 48px; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 23px; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.status-dot { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #aab2bf; }
.status-dot.ok::before { background: var(--success); }
.view { padding-top: 26px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.metric { padding: 20px; border-right: 1px solid var(--line); }
.metric:last-child { border: 0; }
.metric span { color: var(--muted); }
.metric strong { display: block; margin-top: 10px; font-size: 26px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 12px; }
.section-header:first-child { margin-top: 0; }
.section-header h2 { margin: 0; font-size: 17px; }
.section-header p { margin: 5px 0 0; color: var(--muted); }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #536074; background: #f8f9fb; font-size: 12px; font-weight: 700; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: #edf1f6; color: #536074; font-size: 12px; }
.badge.on { background: #e7f6ee; color: #187149; }
.badge.off { background: #f2f3f5; color: #747d8b; }
.badge.admin { background: #e9eefc; color: #315bb3; }
.actions { display: flex; gap: 7px; white-space: nowrap; }
.notice { margin-top: 20px; padding: 11px 14px; border: 1px solid #bfd2f8; border-radius: 6px; color: #244f9b; background: #edf4ff; }
.notice.error { border-color: #efc9ce; color: #992936; background: #fff2f3; }
.empty { padding: 44px; text-align: center; color: var(--muted); background: white; border: 1px solid var(--line); border-radius: 8px; }
.route-grid { display: grid; gap: 12px; }
.route-row { display: grid; grid-template-columns: 130px 1.1fr 1.2fr 120px 110px 100px 90px; gap: 10px; align-items: end; padding: 14px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.route-row h3 { margin: 0 0 10px; font-size: 15px; align-self: center; }
.route-row label { font-size: 12px; }
.toggle-label { flex-direction: row; align-items: center; align-self: end; height: 40px; }
.toggle-label input { width: 18px; height: 18px; box-shadow: none; }
dialog { width: min(620px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; box-shadow: 0 24px 70px rgba(20, 28, 42, .22); }
dialog::backdrop { background: rgba(20, 25, 34, .45); }
dialog form { padding: 22px; }
.dialog-shell { padding: 22px; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.dialog-title h2 { margin: 0; font-size: 19px; }
.icon-button { width: 34px; padding: 0; font-size: 24px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.single-column { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }
.dialog-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.capability-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 24px; }
.capability { padding: 16px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.capability strong { display: block; margin-top: 8px; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 160px 140px auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.toolbar label { font-size: 12px; }
.member-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.avatar { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #e9eef7; color: #42516a; font-weight: 750; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-link { border: 0; padding: 0; min-height: auto; background: transparent; text-align: left; color: #171c26; font-weight: 700; }
.member-link:hover { background: transparent; color: var(--primary); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; color: var(--muted); }
.member-dialog { width: min(820px, calc(100vw - 32px)); }
.member-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fb; }
.member-identity { display: flex; gap: 14px; align-items: center; min-width: 0; }
.member-identity .avatar { width: 52px; height: 52px; font-size: 18px; }
.member-identity h3 { margin: 0 0 5px; font-size: 18px; }
.member-identity p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.detail-item { padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.detail-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 10px; font-size: 15px; }
.profile-inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.recent-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px 150px; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); align-items: center; }
.recent-row:last-child { border-bottom: 0; }
.recent-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .route-row { grid-template-columns: 1fr 1fr; }
  .route-row h3 { grid-column: span 2; }
  .toolbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-footer { margin-top: 18px; }
  .main { padding: 0 16px 32px; }
  .topbar { min-height: 82px; }
  .metric-grid, .capability-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .toolbar { grid-template-columns: 1fr; }
  .member-summary { grid-template-columns: 1fr; }
  .detail-actions { justify-content: flex-start; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .recent-row { grid-template-columns: 1fr; gap: 4px; }
}
