:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #272337;
  background: #f7f7fb;
  font-synthesis: none;
  --purple: #5847f8;
  --purple-dark: #4634d8;
  --purple-light: #f0ecff;
  --ink: #272337;
  --muted: #6f6c79;
  --line: #eeedf3;
  --green: #28866b;
  --red: #c44962;
  --amber: #a97620;
  --sidebar: 220px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 14px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, input, select, textarea { transition: border-color .16s, background .16s, box-shadow .16s; }
:focus-visible { outline: 1.5px solid #8a84a0; outline-offset: 2px; }
[hidden] { display: none !important; }
button svg { flex-shrink: 0; }
a { color: var(--purple); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; line-height: 1.4; letter-spacing: -.7px; font-weight: 700; }
h2 { font-size: 17px; letter-spacing: -.2px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
small { font-size: 12px; }
.icon { width: 20px; height: 20px; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.text-link { color: var(--purple); padding: 0; border: 0; background: none; text-align: left; font-weight: 550; }
.text-link:hover { color: var(--purple-dark); text-decoration: underline; }
.text-danger { color: var(--red); }
.app-shell { min-height: 100vh; }
.sidebar { width: var(--sidebar); background: white; position: fixed; inset: 0 auto 0 0; border-right: 1px solid var(--line); padding: 24px 14px 18px; display: flex; flex-direction: column; overflow-y: auto; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 13px; }
.brand-mark { height: 42px; width: 42px; background: var(--purple); color: white; display: grid; place-items: center; border-radius: 10px; box-shadow: 0 5px 13px #7356e728; }
.brand-mark .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.brand-name { font-size: 21px; font-weight: 750; letter-spacing: 2px; line-height: 1.3; }
.brand-tag { font-size: 12px; color: #9c96ad; letter-spacing: 2.2px; margin-top: 3px; }
.nav-label { font-size: 12px; letter-spacing: 1.4px; color: #aaa5b6; margin: 41px 16px 13px; }
.nav { display: grid; gap: 6px; }
.nav-button { display: flex; width: 100%; align-items: center; gap: 13px; text-align: left; border: 0; background: none; color: #827c91; padding: 13px 16px; border-radius: 10px; font-size: 13px; font-weight: 550; }
.nav-button:hover { background: #f8f6ff; color: var(--purple); }
.nav-button.active { color: var(--purple); background: var(--purple-light); font-weight: 650; }
.nav-button.active::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--purple); margin-left: auto; }
.nav-text { min-width: 0; overflow-wrap: anywhere; }
.nav-secondary { display: grid; gap: 6px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.nav-section-label { padding: 0 16px 5px; font-size: 11px; color: #a09aaa; letter-spacing: 1px; }
.nav-button.with-status { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; padding-left: 12px; padding-right: 12px; }
.nav-button.with-status.active::after { content: none; }
.nav-status { align-self: center; padding: 2px 4px; border-radius: 5px; background: #f3f1f6; color: #8a8197; font-size: 9px; line-height: 1.4; font-weight: 500; white-space: nowrap; }
.nav-button.with-status.active .nav-status { background: #e7e0fb; color: #7b63b5; }
.sidebar-bottom { margin-top: auto; padding-top: 28px; }
.sidebar-note { border: 1px solid #ebe6fb; background: linear-gradient(145deg, #faf8ff, #f5f2ff); border-radius: 12px; padding: 15px; margin-bottom: 19px; font-size: 12px; color: #8b7ead; }
.sidebar-note .icon { color: var(--purple); margin-bottom: 7px; }
.sidebar-note strong { display: block; font-size: 12px; color: #675b87; margin-bottom: 4px; }
.account { display: flex; align-items: center; gap: 10px; padding: 16px 6px 0; border-top: 1px solid var(--line); }
.avatar { height: 34px; width: 34px; border-radius: 10px; background: #eeebf9; color: var(--purple); display: grid; place-items: center; font-size: 13px; font-weight: 650; flex-shrink: 0; }
.account-name { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.account-role { font-size: 12px; color: var(--muted); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; background: none; color: #948ca5; border: 0; width: 34px; height: 34px; border-radius: 8px; padding: 6px; }
.icon-button:hover { color: var(--purple); background: var(--purple-light); }
.workspace { margin-left: var(--sidebar); min-width: 0; }
.topbar { height: 78px; border-bottom: 1px solid var(--line); background: #ffffffd9; padding: 0 37px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.breadcrumb { font-size: 12px; display: flex; gap: 14px; color: #a5a0b0; align-items: center; }
.breadcrumb .current { color: #665c79; }
.topbar-right { display: flex; align-items: center; gap: 20px; font-size: 12px; color: var(--muted); }
.session-state { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4fa88b; }
.mobile-toggle { display: none; }
.page { max-width: 1500px; margin: 0 auto; padding: 32px 37px 50px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 27px; }
.page-heading p { font-size: 12px; color: var(--muted); margin-top: 6px; }
.eyebrow { color: var(--purple); font-size: 12px; font-weight: 650; letter-spacing: 1.8px; margin-bottom: 8px; text-transform: uppercase; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 10px 16px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 550; text-decoration: none; white-space: nowrap; min-height: 39px; }
.button .icon { width: 16px; height: 16px; }
.button.primary { background: var(--purple); color: white; box-shadow: 0 3px 8px #7356e71a; }
.button.primary:hover { background: var(--purple-dark); }
.button.secondary { background: white; border-color: #e7e3ee; color: #70677e; }
.button.secondary:hover { background: #faf8ff; border-color: #c9bbed; }
.button.ghost { background: #f7f5fb; color: #77658f; }
.button.ghost:hover { background: var(--purple-light); color: var(--purple); }
.button.danger { color: var(--red); background: #fff1f4; border-color: #f6dce2; }
.button.small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.button.full { width: 100%; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 25px; }
.metric { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 21px 22px; }
.metric-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; background: var(--purple-light); color: var(--purple); }
.metric-icon.green { background: #eaf7f0; color: #479476; }
.metric-icon.blue { background: #edf3ff; color: #638bd3; }
.metric-icon.amber { background: #fcf4e7; color: #c1984f; }
.metric-label { color: #8d869a; font-size: 12px; margin: 15px 0 4px; }
.metric-value { font-size: 30px; font-weight: 650; letter-spacing: -.6px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.metric-foot { border-top: 1px solid #f3f1f7; margin-top: 14px; padding-top: 10px; color: #aaa3b3; font-size: 12px; }
.panel { border: 1px solid var(--line); background: white; border-radius: 10px; overflow: hidden; min-width: 0; }
.panel + .panel { margin-top: 22px; }
.panel-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.panel-head p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.panel-body { padding: 23px 24px; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 23px; margin-top: 23px; }
.two-columns .panel + .panel { margin: 0; }
.payment-row { display: flex; align-items: center; gap: 13px; padding: 17px 0; }
.payment-row + .payment-row { border-top: 1px solid var(--line); }
.payment-symbol { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; color: #827891; }
.payment-row strong { font-size: 12px; font-weight: 550; }
.payment-row p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 12px; line-height: 1.5; font-weight: 500; border-radius: 5px; white-space: nowrap; background: #f3f1f7; color: #8b8396; }
.badge.green { background: #edf7f1; color: var(--green); }
.badge.purple { background: var(--purple-light); color: var(--purple); }
.badge.amber { background: #fff7e9; color: var(--amber); }
.badge.red { background: #fff0f3; color: var(--red); }
.quick-actions { display: grid; gap: 10px; }
.quick-action { background: white; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 12px; text-align: left; padding: 15px; }
.quick-action:hover { border-color: #d0c4f6; background: #fcfbff; }
.quick-action > .icon { color: var(--purple); }
.quick-action strong { display: block; font-size: 12px; font-weight: 550; color: #635972; }
.quick-action span { display: block; font-size: 12px; color: #a099ac; margin-top: 3px; }
.section-note { color: #a099ac; font-size: 12px; padding: 15px 23px; border-top: 1px solid var(--line); }
.notice { padding: 12px 15px; border: 1px solid #e7e0fa; border-radius: 8px; background: #faf8ff; color: #8a78aa; font-size: 12px; margin: 0 0 20px; }
.notice.amber { border-color: #f4e5c8; background: #fffbf4; color: #a18454; }
.notice.error { border-color: #f3d5dd; background: #fff5f7; color: #b75c73; }
.notice.success { border-color: #d9eee4; background: #f4fbf7; color: #39866a; }
.toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 17px 23px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; align-items: center; min-width: 210px; }
.search-form input { width: 260px; max-width: 100%; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; white-space: nowrap; }
thead { color: #a39bae; background: #fbfafc; font-size: 12px; }
th { font-weight: 500; padding: 12px 22px; border-bottom: 1px solid var(--line); }
td { padding: 14px 18px; border-bottom: 1px solid #f3f1f6; color: #7b708b; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfcff; }
td .primary-text { color: #51465f; font-weight: 550; }
.cell-subtitle { font-size: 12px; color: #a59daf; margin-top: 3px; }
.table-actions { display: flex; align-items: center; gap: 7px; }
.table-count { font-size: 12px; color: #a19aaa; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.amount { color: #51465f; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.plan-grid > .panel { margin-top: 0; }
.catalog-group + .catalog-group { margin-top: 26px; }
.catalog-group > h2 { margin-bottom: 14px; }
.minute-summary { margin-top: 0; }
.usage-statistics { display: grid; gap: 16px; }
.usage-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.usage-periods { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: #f7f5fa; }
.usage-periods .button { border-color: transparent; background: transparent; padding: 8px 14px; border-radius: 7px; }
.usage-periods .button[aria-pressed="true"] { color: var(--purple); background: white; box-shadow: 0 1px 4px #49366e10; }
.usage-periods .button:focus-visible { outline: 2px solid #b5a6dc; outline-offset: 2px; }
.usage-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.usage-metric { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fcfbfe; }
.usage-metric-label { color: #81758f; font-size: 12px; margin-bottom: 10px; }
.usage-metric-value { display: block; color: #362d45; font-size: 23px; font-weight: 650; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-metric-foot { font-size: 12px; color: #94889f; margin-top: 12px; }
.usage-metrics > .notice { grid-column: 1 / -1; }
.usage-statistics > [role="status"]:empty { display: none; }
@media (max-width: 900px) {
  .usage-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .usage-metrics { grid-template-columns: minmax(0, 1fr); }
  .usage-periods { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .usage-periods .button { padding: 8px; }
}
.portal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.device-list { display: grid; gap: 12px; }
.device-session { display: flex; align-items: center; gap: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.device-session strong { overflow-wrap: anywhere; }
.device-session .grow { min-width: 0; }
.minute-history { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.minute-history > summary { cursor: pointer; color: #70677e; font-weight: 550; margin-bottom: 12px; }
.ledger-reason { display: block; max-width: 320px; white-space: pre-wrap; overflow-wrap: anywhere; }
.plan-card { padding: 24px; display: flex; flex-direction: column; gap: 17px; }
.plan-card .price { font-size: 28px; font-weight: 650; letter-spacing: -.7px; }
.plan-card .description { color: #a098aa; font-size: 12px; min-height: 38px; white-space: pre-wrap; }
.plan-card .plan-meta { display: grid; gap: 7px; font-size: 12px; color: #9c93a6; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.plan-card .plan-actions { margin-top: auto; display: flex; gap: 9px; }
.plan-card .plan-actions > * { flex: 1; }
.activity-list { padding: 0 23px; }
.activity { display: flex; align-items: flex-start; gap: 13px; padding: 17px 0; }
.activity + .activity { border-top: 1px solid var(--line); }
.activity-icon { width: 29px; height: 29px; border-radius: 8px; color: #8e7dc1; background: #f6f3fc; display: grid; place-items: center; flex-shrink: 0; }
.activity-icon .icon { width: 14px; height: 14px; }
.activity strong { font-size: 12px; font-weight: 500; color: #7b708c; }
.activity p, .activity time { color: #afa7b8; font-size: 12px; }
.empty-state, .loading-state, .error-state { padding: 60px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 11px; }
.empty-icon { height: 52px; width: 52px; display: grid; place-items: center; border-radius: 15px; background: #f5f2fc; color: #ab9cd3; margin-bottom: 2px; }
.empty-icon .icon { height: 24px; width: 24px; }
.empty-state strong, .error-state strong { font-size: 14px; font-weight: 550; color: #776b88; }
.empty-state p, .error-state p, .loading-state p { max-width: 430px; font-size: 12px; color: #a49aac; }
.boot-screen { display: flex; min-height: 100vh; align-items: center; justify-content: center; gap: 12px; color: #9b8bb3; font-size: 13px; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid #ece6fa; border-top-color: var(--purple); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-layout { min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: #f7f7fa; }
.login-main { width: 100%; padding: 40px 20px; }
.login-card { width: 100%; max-width: 430px; margin: 0 auto; padding: 32px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.login-card .brand { padding: 0; margin-bottom: 30px; }
.login-card h1 { font-size: 25px; }
.login-card > p { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.login-card form { display: grid; gap: 16px; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-bottom: 23px; border: 1px solid var(--line); border-radius: 10px; background: #f8f6fc; }
.auth-tabs .button { min-width: 0; padding: 10px 5px; background: transparent; }
.auth-tabs .button[aria-pressed="true"] { background: white; color: var(--purple); box-shadow: 0 2px 7px #49366e0b; }
.auth-sms { display: grid; gap: 12px; }
.auth-sms .notice, .login-card form > .notice { margin-bottom: 0; }
.auth-sms > .button { justify-self: start; }
.verification-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.verification-fields .button { min-width: 112px; }
.login-card .field-help { font-size: 12px; }
.phone-fields { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; }
.login-caption { color: #b2a8bb; font-size: 12px; text-align: center; margin-top: 25px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { color: #83758e; font-size: 12px; font-weight: 550; }
input:not([type="checkbox"]), select, textarea { border: 1px solid #e6e0ed; background: white; border-radius: 7px; padding: 10px 12px; color: #5d4f6b; outline: none; width: 100%; min-width: 0; font-size: 12px; }
input::placeholder, textarea::placeholder { color: #b7adbf; }
input:focus, select:focus, textarea:focus { border-color: #ac97e7; box-shadow: 0 0 0 3px #7356e70d; }
input:disabled, select:disabled { background-color: #f8f6fa; color: #a99eaf; cursor: not-allowed; }
/* Keep native selection and keyboard behavior; reserve a separate trailing area for the arrow. */
select {
  -webkit-appearance: none;
  appearance: none;
  height: 40px;
  max-width: 100%;
  padding: 0 44px 0 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2383758e' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-size: 16px 16px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select:hover:not(:disabled) { border-color: #c9bbed; }
select:focus-visible { outline: 3px solid #bbaafa; outline-offset: 2px; }
select:disabled { opacity: 1; }
@media (forced-colors: active) {
  select { -webkit-appearance: auto; appearance: auto; background-image: none; padding-right: 12px; }
}
textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.field-help { color: #a89daf; font-size: 12px; line-height: 1.6; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #8b7d96; border-radius: 7px; }
.checkbox input { accent-color: var(--purple); width: 15px; height: 15px; }
.checkbox input:focus { outline: none; box-shadow: none; }
.checkbox:has(input:focus-visible) { outline: 1.5px solid #8a84a0; outline-offset: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-stack { display: grid; gap: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 21px; margin-top: 6px; border-top: 1px solid var(--line); }
.form-error { margin: 0; }
dialog { width: min(520px, calc(100vw - 28px)); border: 0; border-radius: 15px; padding: 0; color: var(--ink); box-shadow: 0 26px 90px #38255f38; max-height: calc(100dvh - 40px); }
dialog.wide { width: min(970px, calc(100vw - 28px)); }
dialog::backdrop { background: #23163560; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 25px 27px 19px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { color: #51415d; font-size: 18px; }
.dialog-heading p { font-size: 12px; color: #aa9bb2; margin-top: 5px; max-width: 710px; }
.dialog-body { padding: 24px 27px 27px; }
.dialog-body .panel { margin-top: 18px; }
.detail-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 23px; }
.detail-item { background: #faf8fc; border: 1px solid var(--line); padding: 13px 15px; border-radius: 8px; }
.detail-item > small { color: #ab9eb5; display: block; font-size: 12px; margin-bottom: 5px; }
.detail-item > strong { color: #776183; font-size: 12px; word-break: break-word; }
.details-pre { white-space: pre-wrap; word-break: break-word; color: #9985a8; background: #faf8fc; border: 1px solid var(--line); border-radius: 8px; padding: 17px; font-size: 12px; max-height: 300px; overflow: auto; }
.toasts { position: fixed; right: 25px; bottom: 25px; display: flex; flex-direction: column; gap: 10px; max-width: min(390px, calc(100vw - 40px)); z-index: 100; }
.toast { padding: 13px 17px; border: 1px solid #e5dcef; border-radius: 10px; background: white; box-shadow: 0 7px 30px #3a24531c; color: #80608c; font-size: 12px; }
.toast.error { color: #be5b78; border-color: #f0d3dd; }
.export-icon { margin: 2px auto 16px; width: 60px; height: 60px; border-radius: 18px; background: #eee8ff; color: var(--purple); display: grid; place-items: center; }
.export-summary { text-align: center; margin-bottom: 24px; }
.export-summary h3 { font-size: 18px; margin-bottom: 7px; }
.export-summary p { font-size: 12px; color: #aa9bb6; }
.noscript { text-align: center; padding: 30px; color: #a4799e; }
.backdrop-button { display: none; }
.checkout-stack { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
.payment-qr { display: block; width: min(100%, 320px); height: auto; margin: 0 auto; background: white; border: 1px solid var(--line); border-radius: 12px; }

@media (max-width: 1200px) {
  :root { --sidebar: 215px; }
  .page { padding: 27px 25px 40px; }
  .topbar { padding: 0 25px; }
  .metric { padding: 18px; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr); }
}
@media (max-width: 950px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: 1fr; }
  .topbar-right time { display: none; }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 244px; }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 40px #3524441c; }
  .backdrop-button.visible { display: block; position: fixed; inset: 0; background: #23163542; border: 0; z-index: 19; }
  .workspace { margin-left: 0; }
  .mobile-toggle { display: inline-flex; }
  .topbar { height: 64px; padding: 0 19px; }
  .breadcrumb { gap: 9px; font-size: 12px; }
  .page { padding: 24px 18px 35px; }
  .page-heading { gap: 12px; margin-bottom: 22px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading > .row { flex-wrap: wrap; }
  .portal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .portal-actions > :first-child { grid-column: 1 / -1; }
  .button, .button.small, .icon-button { min-height: 44px; }
  input:not([type="checkbox"]), select, textarea { font-size: 16px; }
  select { height: 44px; }
  .device-session { flex-wrap: wrap; }
  .device-session > .button { width: 100%; }
  h1 { font-size: 23px; }
  .page-heading p { font-size: 12px; }
  .page-heading .button { padding: 8px 11px; font-size: 12px; }
  .metric-grid { gap: 12px; }
  .metric { padding: 17px; }
  .metric-value { font-size: 27px; }
  .metric-foot { font-size: 9px; }
  .panel-head, .panel-body { padding: 19px; }
  .toolbar { padding: 15px; }
  .search-form { flex: 1; }
  .search-form input { width: 100%; }
  .plan-grid { grid-template-columns: 1fr; }
  .login-card h1 { font-size: 24px; }
  .form-grid, .detail-summary { grid-template-columns: 1fr; gap: 13px; }
  .dialog-heading { padding: 21px; }
  .dialog-body { padding: 21px; }
  .session-state { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Compact management controls retain readable notes and mobile touch targets. */
.user-toolbar { gap: 14px; }
.group-filter { flex-wrap: nowrap; gap: 12px; min-width: 0; max-width: 100%; }
.group-filter select { width: 180px; }
.user-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 230px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.user-note-full { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 0; color: var(--muted); }
.group-list { border-top: 1px solid var(--line); }
.group-item { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.group-item strong { overflow-wrap: anywhere; }
.feature-choices { border: 1px solid var(--line); border-radius: 8px; padding: 4px 14px 10px; margin: 0; }
.feature-choices legend { font-size: 13px; padding: 0 5px; }
.feature-choice { display: flex; align-items: start; gap: 10px; padding: 10px 0; }
.feature-choice + .feature-choice { border-top: 1px solid var(--line); }
.feature-choice input { margin-top: 5px; accent-color: var(--purple); }
.feature-choice strong { font-weight: 550; font-size: 13px; }
.feature-choice:has(input:disabled) { opacity: .65; }
@media (max-width: 720px) {
  .login-main { padding: 22px 14px; }
  .login-card { padding: 24px; }
  .group-filter, .search-form { width: 100%; }
  .group-filter select, .search-form input { flex: 1; width: auto; }
  .user-note { max-width: 180px; }
}

.service-status-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.service-status-item { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px 24px; }
.service-status-item:nth-child(even) { border-left: 1px solid var(--line); }
.service-status-item:nth-child(n + 3) { border-top: 1px solid var(--line); }
.service-status-heading { display: flex; flex-direction: column; gap: 6px; min-height: 64px; }
.service-status-heading p { overflow-wrap: anywhere; }
.service-status-details { display: grid; align-content: start; gap: 10px; min-height: 66px; }
.service-status-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; min-height: 28px; }
.service-status-item .muted { font-size: 12px; }
@media (max-width: 720px) {
  .service-status-list { grid-template-columns: 1fr; }
  .service-status-item { padding: 19px; }
  .service-status-item:nth-child(even) { border-left: 0; }
  .service-status-item + .service-status-item { border-top: 1px solid var(--line); }
  .service-status-heading, .service-status-details { min-height: 0; }
}

.commerce-service-fields { margin: 8px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #faf9ff; }
.commerce-service-fields legend { font-weight: 650; padding: 0 6px; }
.commerce-benefits { display: grid; gap: 10px; padding: 14px 0; }
.commerce-benefits li { list-style: none; padding: 8px 0; border-bottom: 1px solid var(--line); }

.commerce-benefit { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; padding: 8px 0; }
.commerce-benefit strong { text-align: right; }
.commerce-benefit small { grid-column: 1 / -1; font-size: 11px; }

/* Archive uses the same outer-container keyboard focus as other compound controls. */
.archive-workspace {display:grid;grid-template-columns:200px 250px minmax(0,1fr);border:1px solid var(--line);border-radius:14px;background:#fff;min-height:620px;overflow:hidden;margin-top:18px;}
.archive-accounts,.archive-chats{padding:20px 14px;border-right:1px solid var(--line);min-width:0;}
.archive-accounts h3,.archive-chats h3{margin-bottom:16px;}
.archive-account,.archive-chat{width:100%;text-align:left;border:1px solid transparent;border-radius:10px;background:transparent;padding:12px;display:flex;flex-direction:column;gap:6px;overflow-wrap:anywhere;margin-bottom:8px;color:var(--ink);}
.archive-account:hover,.archive-chat:hover{background:#f7f7fb;}
.archive-account[aria-pressed=true],.archive-chat[aria-current=true]{background:var(--purple-light);border-color:#e1dbf6;}
.archive-chats input{width:100%;margin-bottom:14px;}
.archive-detail{min-width:0;}
.archive-detail-header{padding:20px;border-bottom:1px solid var(--line);display:flex;gap:14px;flex-wrap:wrap;align-items:center;justify-content:space-between;overflow-wrap:anywhere;}
.archive-detail-header h2{font-size:16px;}
.archive-segments{display:flex;background:#f5f4f8;padding:4px;border-radius:10px;gap:4px;}
.archive-segments .button[aria-pressed=true]{background:white;color:var(--purple);box-shadow:0 1px 4px #27233712;}
.archive-timeline{padding:20px;max-height:76vh;overflow-y:auto;display:flex;flex-direction:column;gap:16px;background:#fbfafc;}
.archive-event{padding:16px;background:#fff;border:1px solid var(--line);border-radius:12px;min-width:0;overflow-wrap:anywhere;}
.archive-event.outgoing{background:#f1f8f3;border-color:#e3efe6;}
.archive-event-top{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px;}
.archive-text{margin:8px 0;}.archive-text p{white-space:pre-wrap;}
.archive-asset{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:12px;}
.archive-asset img,.archive-asset video{max-width:100%;max-height:360px;border-radius:8px;background:#eee;}
.archive-asset audio{max-width:100%;height:40px;}
.archive-metadata{margin-top:12px;color:var(--muted);font-size:12px;}
.archive-metadata summary{cursor:pointer;border-radius:6px;}
.archive-metadata pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:300px;overflow:auto;}
.archive-summary{padding:0 20px;}.archive-summary:not(:empty){padding:20px;border-bottom:1px solid var(--line);background:#fcfbff;}
.archive-summary-point{margin-top:14px;}.archive-summary-point p{margin:6px 0;white-space:pre-wrap;}
.archive-metrics{margin-top:12px;gap:16px;}
.archive-policy-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:24px 0;}
.archive-workspace button:focus:not(:focus-visible),.archive-workspace input:focus:not(:focus-visible){outline:none;box-shadow:none;}
.archive-workspace button:focus-visible,.archive-workspace input:focus-visible,.archive-metadata summary:focus-visible{outline:1.5px solid #8a84a0;outline-offset:2px;}
.archive-workspace button *:focus{outline:none;box-shadow:none;}
@media(max-width:1150px){.archive-workspace{grid-template-columns:190px minmax(0,1fr);}.archive-accounts{grid-column:1/-1;display:flex;gap:10px;border-right:0;border-bottom:1px solid var(--line);overflow:auto;}.archive-accounts h3{flex-shrink:0;margin:10px;}.archive-account{min-width:200px;max-width:260px;margin:0;}.archive-policy-grid{grid-template-columns:1fr;}}
@media(max-width:700px){.archive-workspace{display:block;}.archive-chats{border-right:0;border-bottom:1px solid var(--line);}.archive-chat-list{display:flex;gap:8px;overflow:auto;max-height:170px;}.archive-chat{min-width:200px;max-width:240px;}.archive-detail-header,.archive-timeline{padding:14px;}.archive-timeline{max-height:none;}.archive-metrics{gap:8px;font-size:12px;}}

/* Storage summary aligns with the shared panel padding. */
.storage-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; padding: 24px; }
.storage-detail { min-width: 0; }
.storage-detail dt { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.storage-detail dd { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .storage-details { grid-template-columns: 1fr; gap: 18px; padding: 19px; }
}
