:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --line: #dfe6e8;
  --line-strong: #c9d4d7;
  --text: #172126;
  --muted: #62717a;
  --primary: #0b7567;
  --primary-strong: #075d53;
  --primary-soft: #e7f4f1;
  --accent: #c77a28;
  --danger: #b83b35;
  --danger-soft: #f9e9e7;
  --sidebar-bg: #0f172a;
  --sidebar-line: rgba(148, 163, 184, 0.16);
  --sidebar-text: #eef5ff;
  --sidebar-muted: #a8bad8;
  --sidebar-accent: #5635f5;
  --sidebar-accent-strong: #6d52ff;
  --shadow: 0 12px 30px rgba(24, 40, 48, 0.08);
  --radius: 0;
  --header-height: 78px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(23, 33, 38, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(23, 33, 38, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #f7f9fa 0%, #eef3f4 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(11, 117, 103, 0.22);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1200;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #13272d;
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-140%);
  transition: transform 0.16s ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 3px solid rgba(11, 117, 103, 0.28);
  outline-offset: 2px;
}

#adminAppShell > .subtitle,
#adminAppShell > #loginForm,
#adminAppShell > #authMessage,
#adminAppShell > .auth-hint,
.panel-tip,
.auth-hint,
.form-note {
  display: none !important;
}

.admin-shell {
  min-height: 100vh;
}

.page-shell {
  width: 100vw;
  min-height: 100vh;
  max-width: none;
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 19px;
  line-height: 1.25;
}

.panel-head-actions,
.import-actions,
.form-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding-bottom: 0;
}

.admin-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100vh;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.admin-side-nav {
  position: sticky;
  top: 0;
  width: 300px;
  max-width: 100%;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--sidebar-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.nav-brand {
  flex: 0 0 auto;
  display: block;
  min-height: 92px;
  padding: 18px 26px 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.nav-brand-title p {
  margin: 0 0 4px;
  color: #b7c8e4;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-brand-title h1 {
  margin: 0;
  color: #fff;
  font-size: 27px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.nav-section-label {
  flex: 0 0 auto;
  margin: 24px 26px 16px;
  color: var(--sidebar-muted);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-nav-list {
  display: grid;
  gap: 4px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 10px 12px 14px;
  scrollbar-color: rgba(148, 163, 184, 0.58) rgba(15, 23, 42, 0.58);
  scrollbar-width: thin;
}

.admin-nav-list::-webkit-scrollbar {
  width: 10px;
}

.admin-nav-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.58);
}

.admin-nav-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(15, 23, 42, 0.58);
  background: rgba(148, 163, 184, 0.58);
}

.admin-nav-list a {
  min-height: 40px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 0;
  color: #bdd0ec;
  font-size: 16px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-group {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-group-toggle {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 4px;
  color: #a8bad8;
  background: transparent;
  text-align: left;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.nav-group-toggle span {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-group-toggle:hover,
.nav-group-toggle:focus-visible {
  color: #d4e2fa;
  background: rgba(99, 102, 241, 0.08);
}

.nav-group-chevron {
  width: 16px;
  height: 16px;
  justify-self: end;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.nav-group.is-collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-group.is-collapsed .nav-group-items {
  display: none;
}

.nav-group.is-empty {
  display: none;
}

.nav-group-label {
  margin: 16px 12px 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-group-label:first-of-type {
  margin-top: 6px;
}

.admin-nav-list a span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon,
.nav-chevron {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-chevron {
  width: 15px;
  height: 15px;
  justify-self: end;
  opacity: 0;
}

.admin-nav-list a:hover,
.admin-nav-list a:focus-visible {
  color: #d9e5ff;
  background: rgba(99, 102, 241, 0.12);
  border-color: transparent;
}

.admin-nav-list a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, var(--sidebar-accent-strong) 0%, var(--sidebar-accent) 100%);
  border-color: transparent;
  font-weight: 500;
}

.admin-nav-list a[aria-current="page"] .nav-chevron {
  opacity: 1;
}

.nav-user-card {
  flex: 0 0 auto;
  margin-top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
}

.nav-user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #4f39f6;
  background: #e7e9ff;
}

.nav-user-avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-user-copy {
  min-width: 0;
}

.nav-user-copy strong,
.nav-user-copy span {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-copy strong {
  color: #fff;
  font-size: 18px;
  font-weight: 500;
}

.nav-user-copy span {
  margin-top: 2px;
  color: #c1d1eb;
  font-size: 14px;
  font-weight: 400;
}

.nav-logout-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  color: #fff;
  background: #0f172a;
}

.nav-logout-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-logout-btn:hover,
.nav-logout-btn:focus-visible {
  color: #fff;
  background: #1e293b;
  border-color: rgba(203, 213, 225, 0.34);
}

.nav-status-footer {
  flex: 0 0 auto;
  margin-top: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 26px;
  border-top: 1px solid var(--sidebar-line);
}

.nav-connection {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 22px;
  color: #d4e2fa;
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
}

.nav-connection::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: none;
}

.nav-connection.is-connected::before {
  background: #10b981;
  box-shadow: none;
}

.nav-connection.is-error::before {
  background: #ef4444;
  box-shadow: none;
}

.nav-status-message {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.admin-page.page-hidden {
  display: none !important;
}

.data-table-page-host,
.admin-page-group {
  display: contents;
}

.data-table-page {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.data-table-page-head {
  margin-bottom: 14px;
}

.data-table-toolbar {
  justify-content: flex-end;
}

.data-table-filter-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 44px;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line);
}

.data-table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
}

.data-table-search span,
.data-table-pager label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.data-table-search input {
  min-width: 240px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.data-table-query-summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.data-table-selection-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef8f7;
  color: #21443f;
  font-size: 12px;
  font-weight: 800;
}

.data-table-selection-bar .link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.data-table-selection-bar .link-btn:hover {
  color: var(--primary-strong);
}

.data-table-selection-bar .link-btn.muted {
  color: var(--muted);
}

.data-table-pager {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 48px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.data-table-pager > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.data-table-pager label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-table-pager select {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.data-table-body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
}

.data-table-detail-drawer {
  width: 360px;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
}

.detail-drawer-form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-drawer-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.detail-drawer-head span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-drawer-fields {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.detail-field {
  display: grid;
  gap: 6px;
}

.detail-field span {
  color: #485963;
  font-size: 12px;
  font-weight: 800;
}

.detail-field input,
.detail-field select,
.detail-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.detail-field textarea {
  min-height: 96px;
}

.reference-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.reference-picker-search {
  grid-column: 1 / 2;
}

.reference-picker-clear {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.reference-picker-clear:hover {
  background: #e8eef1;
  color: var(--text);
}

.reference-picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 34, 42, 0.14);
}

.reference-picker-option {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.reference-picker-option:last-child {
  border-bottom: 0;
}

.reference-picker-option:hover,
.reference-picker-option:focus {
  background: #eef7f6;
}

.reference-picker-option strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.reference-picker-option span,
.reference-picker-empty {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.reference-picker-empty {
  padding: 10px;
}

.revogrid-reference-cell {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0f2933;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.revogrid-reference-cell::after {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #627786;
  border-bottom: 1.5px solid #627786;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.85;
}

.revogrid-reference-cell.is-empty {
  color: var(--muted);
  font-weight: 600;
}

.grid-reference-picker-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 10px;
  max-height: 360px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 34, 42, 0.2);
}

.grid-reference-picker-head {
  display: grid;
  gap: 2px;
}

.grid-reference-picker-head strong {
  color: var(--text);
  font-size: 13px;
}

.grid-reference-picker-head span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.grid-reference-picker-search {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
}

.grid-reference-picker-list {
  min-height: 42px;
  max-height: 210px;
  overflow: auto;
  border: 1px solid var(--line);
}

.grid-reference-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.grid-reference-picker-actions .secondary-btn {
  min-height: 34px;
  padding: 0 12px;
}

.detail-drawer-message {
  min-height: 20px;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-drawer-message.error {
  color: var(--danger);
}

.detail-drawer-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.panel,
.stat-card,
.table-shell,
.revogrid-table-shell,
.status-block,
input,
select,
textarea,
.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn,
.icon-action,
.settings-icon,
.status-pill,
.config-status-card,
.profile-identity-block,
.modal-card,
.grid-value-filter-menu,
.reference-picker-clear,
.reference-picker-menu,
.reference-picker-option,
.grid-value-filter-search,
.grid-value-filter-tools button,
.grid-value-filter-list,
.grid-value-filter-option,
.revogrid-color-readonly {
  border-radius: 0 !important;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.search-field,
.status-block,
.chatgpt-config-form label,
.form-grid label,
.password-form label,
.inventory-grid label {
  display: grid;
  gap: 7px;
}

.search-field span,
.status-block span,
.chatgpt-config-form span,
.form-grid span,
.password-form span,
.inventory-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-block {
  min-height: 58px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.status-block strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
}

.table-operation-status {
  flex: 0 1 420px;
  max-width: 520px;
  min-height: 44px;
  padding: 6px 12px;
  gap: 3px;
  justify-self: center;
}

.table-operation-status span {
  font-size: 11px;
  line-height: 1.1;
}

.table-operation-status strong {
  font-size: 13px;
  line-height: 1.25;
}

.table-operation-status.is-success {
  border-color: rgba(11, 117, 103, 0.28);
  background: var(--primary-soft);
}

.table-operation-status.is-error {
  border-color: rgba(184, 59, 53, 0.28);
  background: var(--danger-soft);
}

.table-operation-status.is-error strong {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  touch-action: manipulation;
}

input::placeholder {
  color: #8a989f;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 117, 103, 0.52);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.list-panel,
.user-panel,
.chatgpt-config-panel,
.import-panel,
.account-panel,
.module-placeholder-panel {
  min-width: 0;
  padding: 14px;
}

.admin-page {
  min-width: 0;
  width: 100%;
  height: 100vh;
}

.module-placeholder-panel {
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
}

.placeholder-card {
  width: min(620px, 100%);
  display: grid;
  gap: 10px;
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.placeholder-card h2 {
  font-size: 26px;
}

.placeholder-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow: auto;
}

.settings-page-head {
  flex: 0 0 auto;
}

.settings-page-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
}

.settings-page-grid {
  display: grid;
  gap: 0;
  align-content: start;
  min-width: 0;
}

.settings-page .settings-block,
.settings-page .user-panel,
.settings-page .chatgpt-config-panel,
.settings-page .account-panel {
  min-width: 0;
  padding: 18px 0;
  overflow: visible;
}

.settings-page .settings-block:not(.hidden) ~ .settings-block:not(.hidden) {
  border-top: 1px solid var(--line);
}

.settings-page .settings-block:not(.hidden):first-child,
.settings-page .settings-block.hidden + .settings-block:not(.hidden) {
  padding-top: 0;
}

.settings-page .settings-block:last-child {
  padding-bottom: 0;
}

.overview-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
}

.overview-stats {
  flex: 0 0 auto;
}

.overview-editor-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.overview-table-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.projects-panel,
.facilities-panel,
.parts-panel,
.logs-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-panel,
.chatgpt-config-panel,
.account-panel {
  overflow: auto;
}

.panel-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.summary-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-shell {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.table-shell.compact {
  max-height: 430px;
}

.revogrid-table-shell {
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.overview-revogrid-shell {
  min-height: 360px;
}

.admin-revogrid {
  width: 100%;
  height: 100%;
  color: #1f2d34;
  font-family: Calibri, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  --revo-grid-primary: #0b7567;
  --revo-grid-primary-transparent: rgba(11, 117, 103, 0.82);
  --revo-grid-header-bg: #f3f7f8;
  --revo-grid-header-color: #34444c;
  --revo-grid-header-border: #d8e2e5;
  --revo-grid-cell-border: #dfe8ea;
  --revo-grid-row-hover: rgba(11, 117, 103, 0.075);
  --revo-grid-focused-bg: rgba(11, 117, 103, 0.08);
  --revo-grid-row-headers-bg: #f3f7f8;
  --revo-grid-row-headers-color: #34444c;
}

.admin-revogrid .rgCell,
.admin-revogrid .rgHeaderCell {
  font-family: Calibri, "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
}

.revogrid-row-checkbox {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  box-sizing: border-box;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--primary);
  vertical-align: middle;
}

.revogrid-row-checkbox-wrap {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.revogrid-header-filter {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.revogrid-header-filter-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revogrid-filter-button {
  position: relative;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #5d6b72;
  cursor: pointer;
}

.revogrid-filter-button:hover,
.revogrid-header-filter.is-active .revogrid-filter-button {
  border-color: rgba(11, 117, 103, 0.25);
  background: rgba(11, 117, 103, 0.1);
  color: var(--primary-strong);
}

.revogrid-filter-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
}

.revogrid-filter-glyph::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 0;
  width: 8px;
  height: 5px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid currentColor;
}

.revogrid-filter-glyph::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 5px;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}

.revogrid-color-readonly {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
  color: var(--muted);
  font-weight: 700;
}

.grid-value-filter-menu {
  position: fixed;
  z-index: 1200;
  width: min(320px, calc(100vw - 16px));
  max-height: min(460px, calc(100vh - 16px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(8, 17, 20, 0.18);
}

.grid-value-filter-title {
  min-width: 0;
  overflow: hidden;
  color: #223139;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-value-filter-search {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
}

.grid-value-filter-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-value-filter-tools button {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #223139;
  background: #f7fafb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.grid-value-filter-tools button:hover {
  border-color: rgba(11, 117, 103, 0.28);
  background: rgba(11, 117, 103, 0.08);
}

.grid-value-filter-tool-spacer {
  flex: 1 1 auto;
  min-width: 4px;
}

.grid-value-filter-list {
  min-height: 92px;
  max-height: 250px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.grid-value-filter-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #223139;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.grid-value-filter-option:hover {
  background: rgba(11, 117, 103, 0.08);
}

.grid-value-filter-option input {
  width: 14px;
  min-height: 14px;
  height: 14px;
  padding: 0;
}

.grid-value-filter-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-value-filter-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.grid-value-filter-empty {
  padding: 28px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.facilities-panel .table-shell,
.parts-panel .table-shell {
  max-height: 560px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: 760px;
}

.projects-panel table {
  min-width: max(100%, 1740px);
}

.projects-panel thead th {
  white-space: nowrap;
  overflow-wrap: normal;
}

.projects-panel th:nth-child(2),
.projects-panel td:nth-child(2) {
  width: 112px;
}

.projects-panel th:nth-child(3),
.projects-panel td:nth-child(3) {
  width: 108px;
}

.projects-panel th:nth-child(4),
.projects-panel td:nth-child(4),
.projects-panel th:nth-child(6),
.projects-panel td:nth-child(6),
.projects-panel th:nth-child(9),
.projects-panel td:nth-child(9),
.projects-panel th:nth-child(12),
.projects-panel td:nth-child(12),
.projects-panel th:nth-child(16),
.projects-panel td:nth-child(16) {
  width: 78px;
}

.projects-panel th:nth-child(5),
.projects-panel td:nth-child(5) {
  width: 172px;
}

.projects-panel th:nth-child(7),
.projects-panel td:nth-child(7),
.projects-panel th:nth-child(8),
.projects-panel td:nth-child(8),
.projects-panel th:nth-child(13),
.projects-panel td:nth-child(13) {
  width: 96px;
}

.projects-panel th:nth-child(10),
.projects-panel td:nth-child(10),
.projects-panel th:nth-child(11),
.projects-panel td:nth-child(11),
.projects-panel th:nth-child(15),
.projects-panel td:nth-child(15) {
  width: 90px;
}

.projects-panel th:nth-child(14),
.projects-panel td:nth-child(14) {
  width: 136px;
}

.projects-panel th:nth-child(17),
.projects-panel td:nth-child(17),
.projects-panel th:nth-child(18),
.projects-panel td:nth-child(18) {
  width: 140px;
}

.facilities-panel table {
  min-width: max(100%, 1080px);
}

.parts-panel table {
  min-width: max(100%, 1480px);
}

th,
td {
  min-width: 0;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #435159;
  background: #f3f7f8;
  font-size: 12px;
  font-weight: 800;
}

thead tr.table-filter-row th {
  top: 30px;
  z-index: 2;
  padding: 4px 5px;
  background: #fff;
  box-shadow: inset 0 -1px 0 var(--line);
}

.table-filter-row input,
.table-filter-row select {
  min-height: 26px;
  padding: 3px 5px;
  border-radius: 6px;
  font-size: 12px;
}

tbody tr:hover {
  background: rgba(11, 117, 103, 0.045);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn,
.icon-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

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

.primary-btn:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.secondary-btn {
  background: #fff;
  color: #223139;
  border: 1px solid var(--line-strong);
}

.secondary-btn:hover {
  border-color: rgba(11, 117, 103, 0.45);
  color: var(--primary-strong);
  transform: translateY(-1px);
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-btn:hover {
  background: #f4d5d1;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled,
.icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.icon-btn {
  width: 44px;
  padding: 0;
  color: #334047;
  background: #f2f5f6;
  font-size: 24px;
}

.icon-action {
  width: 44px;
  padding: 0;
  color: #223139;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover {
  color: var(--primary-strong);
  border-color: rgba(11, 117, 103, 0.45);
  transform: translateY(-1px);
}

.color-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(8, 17, 20, 0.12);
}

.compact-id {
  max-width: 170px;
  word-break: break-all;
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-row.user-actions {
  flex-wrap: nowrap;
}

.user-action-col {
  width: 116px;
}

.icon-action.danger-icon {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(184, 59, 53, 0.2);
}

.icon-action.danger-icon:hover {
  color: #8f2c27;
  background: #f4d5d1;
  border-color: rgba(184, 59, 53, 0.42);
}

.hidden-import-inputs {
  display: none;
}

.import-summary,
.form-message,
.auth-message {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-message:empty,
.import-summary:empty,
.auth-message:empty {
  display: none;
}

.form-message.error,
.auth-message.error {
  color: var(--danger);
}

.settings-panel {
  padding: 16px;
}

.settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.chatgpt-config-form + .settings-card-head {
  margin-top: 20px;
}

.settings-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(11, 117, 103, 0.16);
}

.settings-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(11, 117, 103, 0.16);
  white-space: nowrap;
}

.status-pill:empty {
  display: none;
}

.chatgpt-config-form {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.34fr);
  gap: 14px;
  align-items: start;
}

.config-fields,
.settings-status-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.config-actions {
  justify-content: flex-start;
}

.config-status-card {
  min-height: 74px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.config-status-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.config-status-card strong {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.profile-identity-block {
  min-height: 108px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.profile-identity-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-identity-block strong {
  font-size: 16px;
  line-height: 1.4;
  word-break: break-word;
}

.password-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.password-form .form-message,
.password-form .form-actions {
  grid-column: 1 / -1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 17, 20, 0.42);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 26px 70px rgba(8, 17, 20, 0.24);
}

.modal-card.narrow {
  width: min(720px, 100%);
}

.entity-editor-card {
  width: min(900px, 100%);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.modal-head {
  margin-bottom: 14px;
}

.entity-editor-head {
  align-items: flex-start;
  margin: 0;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.entity-editor-head h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.25;
}

.entity-editor-head span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.entity-editor-form {
  min-height: 0;
  max-height: calc(100vh - 154px);
}

.entity-editor-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.entity-editor-actions {
  margin-top: 0;
}

.detail-field-wide {
  grid-column: 1 / -1;
}

.form-grid,
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full-span {
  grid-column: 1 / -1;
}

.checkbox-field {
  align-content: end;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-inline input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.checkbox-inline span {
  color: var(--text);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .admin-side-nav {
    position: sticky;
    width: 300px;
    min-height: 100vh;
  }

  .admin-nav-list {
    grid-template-columns: 1fr;
  }

  .nav-status-footer {
    margin-top: 0;
  }

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

  .overview-editor-grid {
    grid-template-columns: 1fr;
  }

  .chatgpt-config-form,
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: 100vw;
    margin: 0;
  }

  .panel-head,
  .settings-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-nav-list {
    grid-template-columns: 1fr;
  }

  .admin-nav-list a {
    min-height: 44px;
    font-size: 13px;
  }

  .nav-brand {
    min-height: 58px;
    padding-bottom: 14px;
  }

  .panel-head-actions {
    justify-content: flex-start;
  }

  .table-operation-status {
    width: 100%;
    max-width: none;
  }

  .stats-grid,
  .overview-editor-grid,
  .chatgpt-config-form,
  .profile-layout,
  .entity-editor-fields,
  .form-grid,
  .password-form {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 78px;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
  }
}

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