:root {
  --color-primary: #1a73e8;
  --color-primary-pressed: #1558b0;
  --color-primary-hover: #1765cc;
  --color-primary-container: #e8f0fe;
  --color-primary-container-hover: #d2e3fc;
  --color-success: #188038;
  --color-warning: #f9ab00;
  --color-danger: #d93025;
  --color-text: #202124;
  --color-text-secondary: #5f6368;
  --color-border: #dadce0;
  --color-border-soft: #e8eaed;
  --color-surface: #ffffff;
  --color-surface-variant: #f8fafd;
  --color-surface-container: #f1f3f4;
  --color-page: #f8fafd;
  --shadow-focus: 0 1px 2px rgba(60, 64, 67, 0.16), 0 1px 3px rgba(60, 64, 67, 0.08);
  --shadow-menu: 0 8px 24px rgba(60, 64, 67, 0.18), 0 2px 6px rgba(60, 64, 67, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 24px;
  --font: "Roboto", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

[hidden],
.hidden {
  display: none !important;
}

.login-body {
  min-height: 100vh;
  background: var(--color-surface);
}

.login-shell {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.login-panel {
  width: min(100%, 420px);
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  padding: 40px 36px 36px;
}

.brand-mark,
.rail-brand,
.profile-avatar,
.avatar-link {
  display: grid;
  place-items: center;
  background: var(--color-primary-container);
  color: var(--color-primary);
  font-weight: 700;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: 28px;
}

.login-panel h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.25;
}

.login-subtitle {
  margin: 8px 0 32px;
  color: var(--color-text-secondary);
  font-size: 15px;
}

.login-form,
.filter-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.search-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  padding: 0 12px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.field textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-secondary) 50%),
    linear-gradient(135deg, var(--color-text-secondary) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 19px,
    calc(100% - 12px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 32px;
}

.multi-field {
  align-self: stretch;
}

.multi-combobox {
  position: relative;
}

.multi-trigger {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, transparent 50%, var(--color-text-secondary) 50%) calc(100% - 17px) 19px / 5px 5px no-repeat,
    linear-gradient(135deg, var(--color-text-secondary) 50%, transparent 50%) calc(100% - 12px) 19px / 5px 5px no-repeat,
    #f8fafd;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  padding: 0 34px 0 12px;
  text-align: left;
}

.multi-trigger:hover,
.multi-trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  background-color: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.multi-trigger.has-selection {
  border-color: rgba(26, 115, 232, 0.38);
  background-color: var(--color-primary-container);
  color: var(--color-primary);
  font-weight: 600;
}

.multi-menu {
  position: absolute;
  z-index: 40;
  right: 0;
  left: 0;
  top: calc(100% + 6px);
  display: grid;
  gap: 8px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-menu);
  padding: 8px;
}

.multi-search {
  min-height: 38px;
}

.multi-options {
  display: grid;
  max-height: 236px;
  overflow: auto;
}

.multi-option {
  display: grid;
  min-height: 38px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
  padding: 0 10px;
  text-align: left;
}

.multi-option:hover {
  background: var(--color-surface-container);
}

.multi-option.is-selected {
  background: var(--color-primary-container);
  color: var(--color-primary);
  font-weight: 600;
}

.multi-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
}

.multi-option.is-selected .multi-check {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.multi-option.is-selected .multi-check::before {
  content: "";
  width: 8px;
  height: 4px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.multi-empty {
  color: var(--color-text-secondary);
  padding: 10px;
  text-align: center;
}

.multi-menu-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--color-border-soft);
  padding-top: 8px;
}

.multi-menu-actions .btn {
  min-height: 34px;
  padding: 0 14px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--color-danger);
  font-size: 13px;
}

.btn,
.icon-btn,
.chip,
.tool-button,
.list-action {
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    opacity 120ms ease;
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 500;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-focus);
}

.btn-quiet {
  border-color: transparent;
  background: var(--color-surface);
  color: var(--color-primary);
}

.btn-quiet:hover {
  background: var(--color-primary-container);
}

.btn-full {
  width: 100%;
}

.btn[disabled],
.tool-button[disabled] {
  cursor: not-allowed;
  opacity: 0.68;
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  min-height: 100vh;
  background: var(--color-page);
}

.main-shell {
  min-height: 100vh;
  padding: 0 16px 84px;
}

.top-appbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -16px 10px;
  border-bottom: 1px solid var(--color-border-soft);
  background: rgba(248, 250, 253, 0.94);
  padding: 8px 16px;
  backdrop-filter: blur(12px);
}

.top-appbar h1,
.sheet-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-color: transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.icon-btn:hover {
  background: var(--color-surface-container);
  color: var(--color-primary);
}

.avatar-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.avatar-link:hover {
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.18);
}

.nav-rail {
  display: none;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: 64px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--color-border-soft);
  background: var(--color-surface);
}

.bottom-nav a {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 7px 2px 6px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.bottom-nav span {
  display: grid;
  width: 26px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  font-size: 13px;
}

.bottom-nav b {
  font-weight: 600;
}

.bottom-nav a.is-active {
  color: var(--color-primary);
}

.bottom-nav a.is-active span {
  background: var(--color-primary-container);
}

.page {
  display: none;
  margin: 0 auto;
  max-width: 1280px;
}

body[data-page="accounts"] #page-accounts,
body[data-page="inbound"] #page-inbound,
body[data-page="outbound"] #page-outbound,
body[data-page="me"] #page-me,
body[data-page="users"] #page-users,
body[data-page="external_docs"] #page-external-docs {
  display: block;
}

.account-workbench {
  display: grid;
  gap: 16px;
}

.category-panel,
.query-panel {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.category-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.panel-label {
  margin: 0 0 4px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.category-tab,
.platform-tab {
  border: 0;
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.category-tab {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-text);
  padding: 10px 12px;
  text-align: left;
}

.category-tab:hover,
.category-tab.is-active {
  background: var(--color-primary-container);
  color: var(--color-primary);
}

.category-tab span {
  font-weight: 600;
}

.category-tab small {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.category-tab.is-active small {
  color: var(--color-primary);
}

.account-main {
  min-width: 0;
}

.platform-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--color-border-soft);
  border-radius: 999px;
  background: var(--color-surface);
  padding: 4px;
}

.platform-tab {
  min-height: 36px;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  padding: 0 16px;
  font-weight: 500;
}

.platform-tab:hover,
.platform-tab.is-active {
  background: var(--color-primary-container);
  color: var(--color-primary);
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--color-border-soft);
  border-radius: 999px;
  background: var(--color-surface);
  padding: 4px;
}

.view-tab {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0 18px;
  font: inherit;
  font-weight: 500;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.view-tab:hover,
.view-tab.is-active {
  background: var(--color-primary-container);
  color: var(--color-primary);
}

.query-panel {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
}

.query-wide {
  flex-basis: 100%;
}

.query-panel > .field {
  flex: 1 1 180px;
  min-width: 140px;
}

.query-panel > .query-actions {
  flex: 0 0 auto;
}

.query-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-filter-toggle {
  display: none;
}

.search-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 14px;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  min-height: 56px;
  border-color: transparent;
  border-radius: 28px;
  background: #edf2fa;
  padding-left: 48px;
  font-size: 16px;
  box-shadow: none;
}

.search-field input:hover {
  background: #eaf0f8;
  box-shadow: var(--shadow-focus);
}

.search-field input:focus {
  border-color: transparent;
  background: var(--color-surface);
  box-shadow: var(--shadow-focus);
}

.field-icon {
  position: absolute;
  top: 50%;
  left: 18px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
}

.field-icon .icon {
  width: 18px;
  height: 18px;
}

.filter-strip {
  display: flex;
  gap: 8px;
  margin: 0 -16px 14px;
  overflow-x: auto;
  padding: 0 16px 4px;
  scrollbar-width: none;
}

.filter-strip::-webkit-scrollbar {
  display: none;
}

.chip {
  min-height: 32px;
  flex: 0 0 auto;
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  padding: 0 14px;
  white-space: nowrap;
  font-weight: 500;
}

.chip:hover {
  background: var(--color-surface-container);
}

.chip.is-selected {
  border-color: transparent;
  background: var(--color-primary-container);
  color: var(--color-primary);
  font-weight: 600;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  min-width: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
  padding: 12px 14px;
}

.metric-action {
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.metric-action:hover {
  background: var(--color-primary-container);
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.12);
}

.metric-action:active {
  transform: translateY(1px);
}

.metric-label {
  display: block;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.metric strong {
  display: block;
  min-height: 24px;
  margin-top: 4px;
  color: var(--color-text);
  font-size: 22px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.account-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.account-row {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--color-border-soft);
  padding: 14px;
}

.account-row:last-child {
  border-bottom: 0;
}

.row-top,
.row-meta,
.row-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-title {
  min-width: 0;
}

.row-title strong,
.row-summary,
.row-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title strong {
  display: block;
  font-size: 15px;
}

.row-summary {
  margin: 0;
  color: var(--color-text-secondary);
}

.row-meta {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--color-primary-container);
  color: var(--color-primary);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-chip.claimed {
  background: #e6f4ea;
  color: var(--color-success);
}

.status-chip.disabled {
  background: #fce8e6;
  color: var(--color-danger);
}

.table-surface,
.profile-panel,
.action-list {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.desktop-table {
  display: none;
}

.table-toolbar {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--color-border-soft);
  padding: 0 16px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.table-scroll {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1380px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.compact-table {
  min-width: 1100px;
}

.user-table {
  min-width: 940px;
  table-layout: fixed;
}

.user-table th,
.user-table td {
  padding-right: 10px;
  padding-left: 10px;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 52px;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  width: 130px;
}

.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 220px;
}

.user-table th:nth-child(4),
.user-table td:nth-child(4) {
  width: 88px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 120px;
}

.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 120px;
}

.user-table th:nth-child(7),
.user-table td:nth-child(7) {
  width: 150px;
}

.user-table th:nth-child(8),
.user-table td:nth-child(8) {
  width: 140px;
}

.user-table td:nth-child(8) {
  display: flex;
  gap: 6px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--color-border-soft);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f8fafd;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.table-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background-color: #f8fafd;
  color: var(--color-text);
  font: inherit;
  outline: none;
  padding: 0 12px;
  box-shadow: none;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.table-input:hover {
  border-color: var(--color-border);
  background-color: #f1f4f9;
}

.table-input:focus {
  border-color: var(--color-primary);
  background-color: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

select.table-input {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-secondary) 50%),
    linear-gradient(135deg, var(--color-text-secondary) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 16px,
    calc(100% - 12px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 32px;
}

input.table-input[type="password"],
input.table-input[type="text"],
input.table-input[type="number"] {
  appearance: none;
  -webkit-appearance: none;
}

.table-input-sm {
  min-width: 96px;
}

.table-textarea {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background-color: #f8fafd;
  color: var(--color-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
  padding: 6px 10px;
  margin-top: 8px;
  resize: vertical;
  box-shadow: none;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.table-textarea:hover {
  border-color: var(--color-border);
  background-color: #f1f4f9;
}

.table-textarea:focus {
  border-color: var(--color-primary);
  background-color: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.outbound-filter-panel {
  margin-bottom: 16px;
}

.permission-grid {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  margin: 0;
  padding: 12px;
}

.permission-grid legend {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 0 4px;
}

.permission-grid label {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius);
  background: #f8fafd;
  padding: 0 12px;
  color: var(--color-text);
  font-weight: 500;
}

.user-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px;
}

.user-form > .field {
  flex: 1 1 220px;
  min-width: 160px;
}

.user-form > .permission-grid {
  flex: 1 1 100%;
}

.user-form > .query-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  font-size: 12px;
  color: var(--color-text);
  white-space: nowrap;
}

.inline-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.btn-save-user {
  min-width: 52px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--color-primary-container);
  padding: 0 12px;
  font-weight: 600;
}

.btn-save-user:hover {
  background: #d7e6ff;
}

.data-table tbody tr:hover {
  background: #f8fafd;
}

.data-table .btn {
  min-height: 36px;
  padding: 0 12px;
}

.btn-claim {
  border-color: transparent;
  background: transparent;
  color: var(--color-primary);
}

.btn-claim:hover {
  background: var(--color-primary-container);
}

.data-table td.description-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-action {
  position: sticky;
  right: 0;
  z-index: 3;
  background: inherit;
  box-shadow: -1px 0 0 var(--color-border-soft);
}

.group-row td {
  background: var(--color-surface-container);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.table-toolbar-bottom {
  border-top: 1px solid var(--color-border-soft);
  border-bottom: 0;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.inline-field select {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 32px 0 10px;
}

.data-table td.sticky-action {
  background: var(--color-surface);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.inbound-panel {
  margin-bottom: 16px;
}

.control-metrics {
  margin-bottom: 16px;
}

.material-query-panel {
  margin-bottom: 16px;
}

.secondary-query {
  margin-top: 18px;
}

.control-table {
  margin-bottom: 16px;
}

.muted-section {
  margin-top: 16px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title-row small {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 400;
  flex: 1 1 auto;
}

.working-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.working-filter-row .inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-auto-flow: column;
}

.working-filter-row .inline-field span {
  white-space: nowrap;
}

.working-filter-row .total-info {
  color: var(--color-text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.admin-toolbox {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.admin-toolbox summary {
  display: flex;
  min-height: 58px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  color: var(--color-text);
  font-weight: 600;
}

.admin-toolbox summary::marker {
  color: var(--color-text-secondary);
}

.admin-toolbox summary small {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 400;
}

.toolbox-section {
  border-top: 1px solid var(--color-border-soft);
}

.inbound-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.modal-form {
  grid-template-columns: minmax(0, 1fr);
}

.inbound-textarea,
.inbound-form .query-actions {
  grid-column: 1 / -1;
}

.modal-actions {
  grid-column: 1 / -1;
  border-top: 1px solid var(--color-border-soft);
  margin: 2px -16px -16px;
  padding-top: 14px;
}

.import-result {
  border-top: 1px solid var(--color-border-soft);
  color: var(--color-text-secondary);
  padding: 14px 16px;
}

.import-result strong {
  color: var(--color-text);
}

.import-result ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 18px;
}

.tool-button {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-color: var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 18px;
  font-weight: 500;
  text-align: left;
}

.tool-button[disabled] {
  background: rgba(255, 255, 255, 0.62);
}

.tool-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary-container);
  color: var(--color-primary);
}

.tool-icon .icon {
  width: 18px;
  height: 18px;
}

.section-title {
  border-bottom: 1px solid var(--color-border-soft);
  padding: 16px;
  font-weight: 500;
}

.empty-state {
  display: grid;
  min-height: 116px;
  place-items: center;
  color: var(--color-text-secondary);
  padding: 24px;
  text-align: center;
}

.empty-state-content {
  display: grid;
  max-width: 360px;
  gap: 6px;
}

.empty-state strong {
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
}

.empty-state p {
  margin: 0;
  line-height: 1.5;
}

.stage-strip {
  display: flex;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.stage-strip span {
  position: relative;
  display: grid;
  min-height: 48px;
  flex: 1 1 0;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--color-border-soft);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.stage-strip span:last-child {
  border-right: 0;
}

.stage-strip span:first-child {
  color: var(--color-primary);
}

.profile-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.profile-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--color-border-soft);
  padding-bottom: 10px;
}

.profile-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-list dt {
  color: var(--color-text-secondary);
}

.profile-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.action-list {
  display: grid;
  margin-top: 14px;
  overflow: hidden;
}

.list-action {
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--color-border-soft);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0 14px;
  text-align: left;
}

.list-action:last-child {
  border-bottom: 0;
}

.sheet-backdrop,
.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(32, 33, 36, 0.28);
}

.bottom-sheet,
.modal-panel {
  max-height: 88vh;
  overflow: auto;
  border-radius: 24px 24px 0 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-menu);
}

.sheet-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--color-border-soft);
  padding: 8px 20px;
}

.filter-form {
  padding: 16px;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 20px 20px;
}

.claim-result {
  display: grid;
  gap: 0;
  padding: 8px 20px 16px;
}

.detail-list {
  display: grid;
  border-top: 1px solid var(--color-border-soft);
}

.detail-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--color-border-soft);
  padding: 14px 0;
}

.detail-row dt {
  color: var(--color-text-secondary);
  font-size: 13px;
}

.detail-row dd {
  margin: 0;
  color: var(--color-text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.detail-note {
  margin: 16px 0 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.claim-form-fields {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-soft);
}

.quota-form {
  padding: 16px 20px;
}

.quota-hint {
  margin: 0 0 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.quota-platform-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--color-border-soft);
}

.quota-platform-tab {
  padding: 8px 24px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
}

.quota-platform-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: var(--color-primary-container);
}

.quota-platform-tab:hover:not(.active) {
  background: var(--color-surface-container);
}

.btn-delete-user {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-delete-user:hover {
  background: #fce8e6;
}

.master-only {
  display: none;
}

body:not([data-is-admin-role]) .master-only {
  display: block;
}

.quota-category-list {
  display: grid;
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
  padding-right: 4px;
}

.quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}

.quota-row:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}

.quota-path {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.quota-input {
  flex: 0 0 auto;
  width: 80px;
  text-align: right;
}

.quota-empty {
  margin: 0;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 24px 0;
}

.claim-form-fields .field {
  display: grid;
  gap: 6px;
}

.claim-form-fields .required {
  color: var(--color-error);
}

.claim-json {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--color-surface-variant);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.doc-surface {
  display: block;
  max-width: 960px;
  margin: 0 auto 32px;
  overflow: hidden;
}

.doc-surface > .section-title {
  padding: 20px 28px;
  font-size: 18px;
  font-weight: 600;
}

.doc-block {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--color-border-soft);
  padding: 24px 28px;
}

.doc-block:first-of-type {
  border-top: 0;
}

.doc-block h2,
.doc-block p {
  margin: 0;
}

.doc-block h2 {
  font-size: 18px;
  font-weight: 600;
}

.doc-block p {
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.doc-block pre {
  overflow: auto;
  margin: 0;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--color-surface-variant);
  padding: 14px 16px;
  max-width: 100%;
}

.doc-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.doc-table {
  margin-top: 2px;
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  max-width: min(360px, calc(100vw - 32px));
  border-radius: var(--radius);
  background: var(--color-text);
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow-menu);
}

.global-notice {
  margin-bottom: 12px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  padding: 10px 12px;
}

.desktop-only {
  display: none;
}

@media (max-width: 760px) {
  .category-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-label {
    grid-column: 1 / -1;
  }

  .platform-tabs {
    width: 100%;
  }

  .view-tabs {
    width: 100%;
  }

  .view-tab {
    flex: 1 1 0;
  }

  .query-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .query-wide {
    grid-column: 1 / -1;
  }

  .query-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .login-panel {
    padding: 24px 4px;
  }

  .main-shell {
    padding: 0 12px 76px;
  }

  .top-appbar {
    min-height: 56px;
    margin: 0 -12px 8px;
    padding: 8px 12px;
  }

  .top-appbar h1 {
    font-size: 19px;
  }

  .account-workbench {
    gap: 10px;
  }

  .category-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .panel-label {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .category-tab {
    min-height: 54px;
    padding: 9px 10px;
  }

  .category-tab small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .platform-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 10px;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 10px;
  }

  .platform-tab {
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
  }

  .view-tab {
    min-width: 0;
    padding: 0 10px;
    white-space: nowrap;
  }

  .query-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
  }

  .inbound-form,
  .user-form {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .user-form > .field,
  .user-form > .query-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .query-wide {
    flex-basis: 100%;
  }

  .field {
    gap: 6px;
  }

  .field input,
  .field select {
    min-height: 42px;
  }

  .query-actions {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
  }

  .mobile-filter-toggle {
    display: inline-flex;
  }

  .advanced-field {
    display: none;
  }

  .query-panel.is-expanded .advanced-field {
    display: grid;
  }

  .search-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-bar .btn-primary {
    min-height: 44px;
  }

  .metric-strip,
  .page-accounts .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    padding: 10px;
  }

  .metric strong {
    font-size: 17px;
    min-height: 22px;
  }

  .account-list {
    border-radius: var(--radius-lg);
  }

  .account-row {
    gap: 9px;
    padding: 12px;
  }

  .row-top,
  .row-actions {
    align-items: flex-start;
  }

  .row-title strong,
  .row-summary,
  .row-meta span {
    white-space: normal;
  }

  .row-summary {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.45;
  }

  .row-meta {
    display: grid;
    gap: 4px;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .btn-claim {
    min-height: 34px;
    padding: 0 12px;
  }

  .action-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-strip span:nth-child(2) {
    border-right: 0;
  }
}

@media (min-width: 900px) {
  .app-shell {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .nav-rail {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-right: 1px solid var(--color-border-soft);
    background: var(--color-surface);
    padding: 16px 8px;
  }

  .rail-brand {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 18px;
  }

  .nav-link {
    display: grid;
    width: 64px;
    min-height: 60px;
    place-items: center;
    border-radius: 18px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
  }

  .nav-link:hover {
    background: var(--color-surface-container);
    color: var(--color-text);
  }

  .nav-link.is-active {
    background: var(--color-primary-container);
    color: var(--color-primary);
  }

  .nav-link.is-active:hover {
    background: var(--color-primary-container-hover);
  }

  .nav-glyph {
    display: grid;
    width: 32px;
    height: 26px;
    place-items: center;
  }

  .bottom-nav {
    display: none;
  }

  .main-shell {
    padding: 0 32px 40px;
  }

  .top-appbar {
    min-height: 72px;
    margin: 0 -32px 22px;
    padding: 10px 32px;
  }

  .account-workbench {
    grid-template-columns: 188px minmax(0, 1fr);
    align-items: start;
  }

  .category-panel {
    position: sticky;
    top: 92px;
  }

  .query-panel {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .page-accounts .multi-field {
    grid-column: span 2;
  }

  .query-wide {
    grid-column: span 2;
  }

  .search-bar {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 12px;
  }

  .search-bar .btn-primary {
    min-height: 56px;
    border-radius: 28px;
    background: var(--color-surface);
    color: var(--color-primary);
  }

  .search-bar .btn-primary:hover {
    background: var(--color-primary-container);
    box-shadow: none;
  }

  .metric-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .page-accounts .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .desktop-table {
    display: block;
  }

  .mobile-list,
  #loadMoreAccounts {
    display: none;
  }

  .desktop-only {
    display: inline-flex;
  }

  .sheet-backdrop,
  .modal-backdrop {
    align-items: center;
    justify-items: center;
    padding: 24px;
  }

  .bottom-sheet,
  .modal-panel {
    width: min(560px, 100%);
    border-radius: var(--radius-xl);
  }

  .filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-actions {
    grid-column: 1 / -1;
  }
}

.details-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-cell:hover {
  white-space: normal;
  word-break: break-all;
}
