:root {
  color-scheme: light;
  --navy: #17263b;
  --navy-2: #213653;
  --blue: #255ca8;
  --blue-soft: #eef4fc;
  --teal: #16877c;
  --red: #b5473d;
  --amber: #a26812;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #dde3ea;
  --line-soft: #edf0f3;
  --text: #172033;
  --muted: #687386;
  --subtle: #8c96a6;
  --shadow: 0 12px 34px rgba(23, 38, 59, .07);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px 16px; display: flex; flex-direction: column; background: var(--navy); color: #fff; }
.brand { min-height: 58px; padding: 0 10px; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; flex: none; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; background: #fff; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 16px; }
.brand small { color: #9facc0; font-size: 9px; letter-spacing: .14em; }
.sidebar nav { margin-top: 31px; display: grid; gap: 6px; }
.nav-item { width: 100%; height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 8px; background: transparent; color: #afbac9; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #fff; color: var(--navy); font-weight: 700; }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; }
.nav-icon svg, .empty-icon svg, .audit-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-note { margin: auto 6px 18px; padding: 14px; display: grid; gap: 6px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.04); }
.sidebar-note strong { font-size: 12px; }
.sidebar-note span { color: #9facc0; font-size: 11px; line-height: 1.6; }
.account { min-height: 62px; padding: 10px 7px 0; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; border-top: 1px solid rgba(255,255,255,.12); }
.account .avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--navy); font-size: 12px; font-weight: 800; }
.account .avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: contain; }
.account > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.account strong, .account small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 12px; }
.account small { margin-top: 2px; color: #91a0b4; font-size: 10px; }
.account a { color: #aeb9c9; font-size: 11px; text-decoration: none; }

.main { min-width: 0; padding: 0 28px 32px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.sync-state { height: 36px; padding: 0 11px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 11px; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(22,135,124,.12); }
.primary-button, .secondary-button, .danger-button { min-height: 38px; padding: 0 15px; border-radius: 7px; font-weight: 700; }
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { background: #1e4e91; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--text); }
.danger-button { border: 1px solid #e9beb9; background: #fff5f4; color: var(--red); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { cursor: wait; opacity: .55; }

.stats-grid { margin: 22px 0 18px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stats-grid article { min-height: 112px; padding: 17px 18px; display: grid; grid-template-columns: 1fr auto; align-content: space-between; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 4px 14px rgba(23,38,59,.025); }
.stats-grid span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stats-grid strong { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 28px; letter-spacing: -.04em; }
.stats-grid small { color: var(--subtle); font-size: 10px; }

.view { display: none; }
.view.active { display: block; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: var(--shadow); }
.panel-head { min-height: 74px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.members-layout { min-height: 570px; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.35fr); gap: 14px; }
.member-directory, .member-detail { min-width: 0; }
.member-directory .panel-head { align-items: stretch; flex-direction: column; }
.directory-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.member-directory .filters { width: 100%; }
.member-directory .search-field { min-width: 0; flex: 1; }
.filters { display: flex; align-items: center; gap: 7px; }
.search-field { height: 36px; min-width: 220px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.search-field span { color: var(--subtle); font-size: 17px; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.filters select { height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 11px; }
.member-list { max-height: 610px; overflow: auto; }
.member-row { width: 100%; min-height: 76px; padding: 11px 16px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; border: 0; border-bottom: 1px solid var(--line-soft); background: #fff; color: var(--text); text-align: left; }
.member-row:hover { background: #f8fafc; }
.member-row.active { background: var(--blue-soft); box-shadow: inset 3px 0 var(--blue); }
.member-avatar { width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 9px; background: #fff; }
.member-avatar img { width: 100%; height: 100%; display: block; object-fit: contain; }
.member-row.active .member-avatar { border-color: #c9daf1; background: #fff; }
.member-row > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.member-row > span:last-child { display: grid; justify-items: end; gap: 5px; }
.member-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.member-row small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.member-service-count { padding-right: 1px; }
.status-badge, .role-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 0 7px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.status-badge.active { background: #eaf7f4; color: #087568; }
.status-badge.disabled { background: #f7eceb; color: var(--red); }
.role-badge { background: #eef2f6; color: #596579; }

.detail-head { min-height: 96px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line-soft); }
.detail-identity { display: flex; align-items: center; gap: 12px; }
.detail-identity .member-avatar { width: 44px; height: 44px; font-size: 14px; }
.detail-identity h2 { margin: 0 0 4px; font-size: 17px; }
.detail-identity p { margin: 0; color: var(--muted); font-size: 11px; }
.detail-actions { display: flex; gap: 8px; }
.detail-body { padding: 18px 20px 24px; }
.detail-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 20px; }
.detail-meta article { padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 7px; background: #fafbfc; }
.detail-meta span { display: block; color: var(--subtle); font-size: 9px; }
.detail-meta strong { display: block; margin-top: 4px; font-size: 11px; }
.admin-role-control { margin: -2px 0 20px; padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) minmax(210px,.55fr); align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.admin-role-control strong, .admin-role-control small { display: block; }
.admin-role-control strong { font-size: 12px; }
.admin-role-control small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.admin-role-control select { width: 100%; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font-size: 11px; }
.section-title { margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title h3 { margin: 0; font-size: 13px; }
.section-title span { color: var(--subtle); font-size: 10px; }
.permission-list { display: grid; gap: 8px; }
.permission-row { min-height: 78px; padding: 11px 12px; display: grid; grid-template-columns: 48px minmax(0,1fr) minmax(170px, .55fr); align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 8px; }
.service-brand { width: 48px; height: 48px; padding: 4px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--blue); }
.service-brand img { width: 100%; height: 100%; display: block; object-fit: contain; }
.service-brand-uts img { padding: 5px 1px; }
.service-brand svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.permission-row > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.permission-row strong { font-size: 12px; }
.permission-row small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.permission-row select { width: 100%; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font-size: 11px; }
.permission-row select.changed { border-color: var(--blue); background: var(--blue-soft); }
.service-disabled { opacity: .68; }

.service-grid { padding: 16px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.service-card { min-height: 190px; padding: 16px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; }
.service-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.service-card h3 { margin: 14px 0 6px; font-size: 14px; }
.service-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.service-card footer { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); color: var(--subtle); font-size: 10px; }
.connection-badge { min-height: 23px; padding: 0 7px; display: inline-flex; align-items: center; border-radius: 5px; background: #eaf7f4; color: #087568; font-size: 10px; font-weight: 700; }
.connection-badge.pending { background: #fff4df; color: var(--amber); }
.service-roles { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 5px; }
.service-control { margin-top: 14px; padding-top: 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 9px; border-top: 1px solid var(--line-soft); }
.service-control label { color: var(--muted); font-size: 9px; font-weight: 700; }
.service-control select { width: 100%; height: 34px; margin-top: 5px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); font-size: 10px; }
.service-control button { min-height: 34px; padding: 0 11px; font-size: 10px; }

.audit-list { min-height: 420px; }
.audit-row { min-height: 72px; padding: 12px 18px; display: grid; grid-template-columns: 40px minmax(0,1fr) 150px; align-items: center; gap: 11px; border-bottom: 1px solid var(--line-soft); }
.audit-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: #eef2f6; color: var(--navy); font-size: 10px; font-weight: 800; }
.audit-row strong { display: block; font-size: 12px; }
.audit-row p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.audit-row time { color: var(--subtle); font-size: 10px; text-align: right; }
.usage-summary { margin: 0 0 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.usage-summary article { min-height: 108px; padding: 16px 17px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 4px 14px rgba(23,38,59,.025); }
.usage-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.usage-summary strong { margin-top: 10px; font-size: 27px; letter-spacing: -.04em; }
.usage-summary strong.usage-person { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.usage-summary small { margin-top: auto; color: var(--subtle); font-size: 9px; }
.usage-panel { margin-bottom: 14px; }
.usage-table-wrap { overflow-x: auto; }
.usage-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.usage-table th { height: 42px; padding: 0 13px; border-bottom: 1px solid var(--line); background: #fafbfc; color: var(--subtle); font-size: 9px; font-weight: 800; text-align: left; white-space: nowrap; }
.usage-sort-button { min-height: 42px; margin: 0; padding: 0; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.usage-sort-button:focus-visible { border-radius: 5px; outline: 2px solid rgba(39,95,166,.28); outline-offset: 2px; }
.usage-sort-icon { width: 8px; height: 13px; display: inline-flex; flex-direction: column; justify-content: center; gap: 2px; opacity: 0; transform: translateX(-2px); transition: opacity .14s ease, transform .14s ease; }
.usage-sort-icon i { width: 0; height: 0; display: block; border-right: 4px solid transparent; border-left: 4px solid transparent; }
.usage-sort-icon i:first-child { border-bottom: 4px solid currentColor; }
.usage-sort-icon i:last-child { border-top: 4px solid currentColor; }
.usage-sort-button:hover .usage-sort-icon, .usage-sort-button:focus-visible .usage-sort-icon, .usage-sort-button[data-direction]:not([data-direction=""]) .usage-sort-icon { opacity: 1; transform: translateX(0); }
.usage-sort-button[data-direction="asc"] .usage-sort-icon i:last-child, .usage-sort-button[data-direction="desc"] .usage-sort-icon i:first-child { opacity: .25; }
.usage-sort-button[data-direction]:not([data-direction=""]) { color: var(--blue); }
.usage-table td { min-height: 64px; padding: 10px 13px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.usage-table tbody tr:last-child td { border-bottom: 0; }
.usage-table tbody tr:hover { background: #fafcff; }
.usage-rank { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 7px; background: #eef2f6; color: var(--muted); font-size: 10px; font-weight: 800; }
.usage-rank.top-1 { background: #fff0c9; color: #8a5b00; }
.usage-rank.top-2 { background: #edf1f5; color: #526174; }
.usage-rank.top-3 { background: #f5e8df; color: #8a4c2c; }
.usage-member { min-width: 145px; display: flex; align-items: center; gap: 9px; }
.usage-member .member-avatar { width: 32px; height: 32px; flex: none; }
.usage-member > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.usage-member strong, .usage-member small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-member strong { color: var(--text); font-size: 11px; }
.usage-member small { color: var(--subtle); font-size: 9px; }
.usage-count { color: var(--blue); font-size: 16px; }
.brand-split { display: inline-flex; align-items: center; gap: 6px; }
.brand-split b { min-width: 22px; min-height: 22px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #eef4fc; color: var(--blue); font-size: 10px; }
.brand-split b:last-child { background: #f5eef9; color: #75448c; }
.brand-split i { color: var(--subtle); font-style: normal; }
.usage-latest { display: inline-flex; flex-direction: column; gap: 3px; }
.usage-latest strong { color: var(--muted); font-size: 11px; font-weight: 500; }
.usage-latest small { color: var(--subtle); font-size: 9px; }
.recent-usage-list { display: grid; }
.recent-usage-row { min-height: 66px; padding: 10px 17px; display: grid; grid-template-columns: 60px minmax(0,1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.recent-usage-row:last-child { border-bottom: 0; }
.recent-usage-row > span:nth-child(2), .recent-usage-row > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.recent-usage-row > span:last-child { align-items: flex-end; }
.recent-usage-row strong { font-size: 11px; }
.recent-usage-row small, .recent-usage-row time { color: var(--subtle); font-size: 9px; }
.recent-brand { min-height: 25px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #eaf1fb; color: var(--blue); font-size: 9px; font-weight: 800; }
.recent-brand.hooray { background: #f5eef9; color: #75448c; }
.empty-state.compact { min-height: 120px; }
.empty-state { min-height: 240px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-state p { max-width: 360px; margin: 7px 0 0; font-size: 11px; line-height: 1.6; }
.empty-icon { width: 48px; height: 48px; margin-bottom: 13px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #f7f9fb; color: var(--blue); }
.detail-empty { min-height: 570px; }

.loading-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; background: var(--navy); color: #fff; }
.loading-screen .brand-mark { width: 64px; height: 64px; }
.loading-screen strong { font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; min-width: 260px; max-width: min(520px, calc(100vw - 32px)); padding: 12px 15px; transform: translateX(-50%); border: 1px solid #b8dacd; border-radius: 8px; background: #f0faf6; color: #087568; box-shadow: 0 16px 40px rgba(23,38,59,.18); font-size: 12px; }
.toast.error { border-color: #e8bbb7; background: #fff4f3; color: var(--red); }

dialog { width: min(510px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px; background: transparent; box-shadow: 0 24px 80px rgba(12,25,43,.25); }
dialog::backdrop { background: rgba(15,27,43,.58); }
.dialog-card { padding: 22px; display: grid; gap: 14px; background: #fff; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head small { color: var(--blue); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.dialog-head h2 { margin: 5px 0 0; font-size: 20px; }
.dialog-head > button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 20px; }
.dialog-head > button:focus:not(:focus-visible) { outline: 0; }
.dialog-copy { margin: -2px 0 2px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.confirm-dialog { width: min(430px, calc(100vw - 32px)); }
.confirm-message { margin: 2px 0 4px; color: var(--text); font-size: 13px; line-height: 1.75; }
.confirm-button.danger { border-color: var(--red); background: var(--red); color: #fff; }
.confirm-button.danger:hover { background: #97382f; }
.dialog-card label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.dialog-card input, .dialog-card select, .dialog-card textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); }
.dialog-card textarea { min-height: 74px; resize: vertical; }
.dialog-card input:focus, .dialog-card select:focus, .dialog-card textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,92,168,.1); }
.dialog-actions { margin-top: 4px; display: flex; justify-content: flex-end; gap: 8px; }

:focus-visible { outline: 2px solid #68a2ef; outline-offset: 2px; }
.pointer-navigation :focus { outline: none !important; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 82px minmax(0,1fr); }
  .brand { justify-content: center; padding: 0; }
  .brand > span:last-child, .nav-item > span:last-child, .sidebar-note, .account > span:nth-child(2), .account a { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .account { grid-template-columns: 1fr; justify-items: center; }
  .members-layout { grid-template-columns: minmax(320px,.8fr) minmax(460px,1.2fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .service-grid { grid-template-columns: repeat(2,1fr); }
  .usage-summary { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 860px) {
  .app-shell { display: block; padding-bottom: 62px; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 30; width: auto; height: 62px; padding: 0; flex-direction: row; }
  .brand, .sidebar-note, .account { display: none; }
  .sidebar nav { width: 100%; margin: 0; display: grid; grid-template-columns: repeat(4,1fr); }
  .nav-item { height: 62px; flex-direction: column; gap: 4px; border-radius: 0; font-size: 10px; }
  .nav-item > span:last-child { display: block; }
  .nav-icon { width: 22px; height: 22px; }
  .main { padding: 0 14px 22px; }
  .topbar { min-height: 82px; }
  .sync-state { display: none; }
  .topbar h1 { font-size: 21px; }
  .members-layout { display: block; }
  .member-directory { margin-bottom: 12px; }
  .member-list { max-height: 330px; }
  .detail-empty { min-height: 280px; }
  .service-grid { grid-template-columns: 1fr; }
  .usage-summary { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stats-grid article { min-height: 94px; padding: 13px; }
  .stats-grid strong { font-size: 23px; }
  .top-actions .primary-button { min-width: 82px; padding: 0 10px; }
  .stacked-on-mobile { align-items: stretch; flex-direction: column; }
  .filters { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; min-width: 0; }
  .detail-head { align-items: flex-start; flex-direction: column; }
  .detail-actions { width: 100%; }
  .detail-actions button { flex: 1; }
  .detail-meta { grid-template-columns: 1fr; }
  .admin-role-control { grid-template-columns: 1fr; }
  .permission-row { grid-template-columns: 48px minmax(0,1fr); }
  .permission-row select { grid-column: 1 / -1; }
  .audit-row { grid-template-columns: 36px minmax(0,1fr); }
  .audit-row time { grid-column: 2; text-align: left; }
  .usage-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .usage-summary article { min-height: 98px; padding: 13px; }
  .recent-usage-row { grid-template-columns: 50px minmax(0,1fr); }
  .recent-usage-row > span:last-child { grid-column: 2; align-items: flex-start; flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
