:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --sidebar-text: #e5e7eb;
  --danger-bg: #fff1f2;
  --danger-text: #be123c;
  --warn-bg: #fff7ed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-page {
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-panel {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 8px; }
h2 { font-size: 18px; margin-bottom: 0; }

.muted { color: var(--muted); }

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--primary-dark); }

button.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

button.ghost {
  background: #f8fafc;
  color: var(--muted);
  border: 1px dashed var(--line);
  cursor: not-allowed;
}

.alert {
  margin: 16px 0;
  border: 1px solid #fecdd3;
  background: var(--danger-bg);
  color: var(--danger-text);
  border-radius: 6px;
  padding: 10px 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.16);
}

.brand strong { font-size: 20px; }
.brand span { color: #9ca3af; font-size: 13px; }

.side-nav {
  display: grid;
  gap: 6px;
}

.main-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.page-title { margin-bottom: 24px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stat-card {
  display: grid;
  gap: 10px;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.stat-card.warning { background: var(--warn-bg); }

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

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #027a48;
  font-size: 13px;
  font-weight: 700;
}

.empty-state {
  min-height: 112px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: #fafafa;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.compact-panel { margin-top: 16px; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; padding: 14px; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar form { width: 100%; justify-content: space-between; }
  .container { width: min(100% - 28px, 1180px); padding-top: 20px; }
  .auth-panel { padding: 22px; }
  .side-nav { grid-template-columns: 1fr; }
}

.split-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.button-link:hover {
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
}

.secondary-link {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-link:hover {
  background: #f8fafc;
  color: var(--text);
}

.table-panel { padding: 0; overflow: hidden; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #f8fafc;
  color: #475467;
  font-weight: 750;
}

.data-table tr:last-child td { border-bottom: 0; }

.actions-col { width: 230px; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.row-actions form { margin: 0; }

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font: inherit;
  font-weight: 650;
}

.link-button:hover {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: underline;
}

.status-pill.disabled {
  background: #f2f4f7;
  color: #667085;
}

.form-panel { max-width: 720px; }

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

.form-grid label {
  font-size: 14px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 760px) {
  .split-title { flex-direction: column; }
  .data-table { min-width: 760px; }
  .table-panel { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
}

.nav-link,
.nav-summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: #cbd5e1;
  padding: 0 12px;
  border-radius: 6px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.nav-summary::-webkit-details-marker { display: none; }
.nav-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.nav-collapse[open] .nav-summary::after { transform: rotate(225deg); }

.nav-link:hover,
.nav-summary:hover {
  background: var(--sidebar-soft);
  color: #fff;
  text-decoration: none;
}

.nav-link.active,
.nav-summary.active {
  background: var(--primary);
  color: #fff;
}

.sub-nav {
  display: grid;
  gap: 4px;
  margin: 6px 0 8px 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(203, 213, 225, 0.22);
}

.sub-link {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  color: #aeb9c8;
  font-size: 14px;
  font-weight: 650;
}

.sub-link:hover {
  background: var(--sidebar-soft);
  color: #fff;
  text-decoration: none;
}

.sub-link.active {
  background: rgba(37, 99, 235, 0.22);
  color: #fff;
}

.nav-collapse.nested {
  display: grid;
  gap: 4px;
}

.nested-summary {
  min-height: 34px;
  padding: 0 10px;
  color: #cbd5e1;
}

.nested-summary::after {
  width: 7px;
  height: 7px;
}

.third-nav {
  display: grid;
  gap: 3px;
  margin: 2px 0 8px 16px;
  padding-left: 10px;
  border-left: 1px solid rgba(203, 213, 225, 0.16);
}

.third-link {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: #93a4b8;
  font-size: 13px;
  font-weight: 600;
}

.third-link:hover {
  background: var(--sidebar-soft);
  color: #fff;
  text-decoration: none;
}

.third-link.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.18);
}

.category-tree {
  display: grid;
  gap: 8px;
}

.category-root-row,
.category-child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.category-root-row {
  min-height: 42px;
  padding: 0 12px;
  font-weight: 750;
}

.category-child-row {
  min-height: 36px;
  margin-left: 18px;
  padding: 0 10px;
  color: var(--muted);
  background: #fafafa;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color) 14%, white);
  color: var(--tag-color);
  border: 1px solid color-mix(in srgb, var(--tag-color) 35%, white);
  font-weight: 750;
}

.color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  border: 1px solid rgba(0,0,0,0.12);
}

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

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  resize: vertical;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
  background: #fff;
}

.check-item input { width: auto; }

.tag-chip.small {
  min-height: 24px;
  padding: 0 8px;
  font-size: 12px;
  margin-right: 4px;
}

.field-value {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  margin: 0 4px 4px 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 650;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.stat-list {
  display: grid;
  gap: 8px;
}

.stat-list > div:not(.empty-state) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
}

.wide-form-panel { max-width: 1080px; }

.item-form {
  display: grid;
  gap: 22px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type { border-bottom: 0; }

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

.upload-box {
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fafafa;
  text-align: center;
  padding: 16px;
}

.upload-box input { max-width: 320px; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,0.94);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.empty-thumb {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.item-table { min-width: 1180px; }

@media (max-width: 980px) {
  .form-grid.three-cols { grid-template-columns: 1fr; }
}

.image-preview-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.image-preview {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.image-preview img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
}

.item-editor-panel {
  padding: 0;
  overflow: hidden;
}

.item-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}

.editor-main {
  display: grid;
  gap: 0;
  min-width: 0;
}

.editor-side {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 0;
  min-height: 100%;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
}

.form-section,
.side-section {
  display: grid;
  gap: 14px;
}

.editor-main .form-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.hero-section {
  background: #fff;
}

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

.rating-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rating-input input {
  max-width: 100px;
}

.rating-input span {
  color: var(--muted);
  font-weight: 700;
}

.image-preview-grid.vertical {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.image-preview-grid.vertical .image-preview img {
  width: 100%;
  height: 82px;
}

.compact-upload {
  min-height: 76px;
  font-size: 14px;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.editor-actions .button-link {
  width: 100%;
}

@media (max-width: 1080px) {
  .item-editor { grid-template-columns: 1fr; }
  .editor-side {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .form-grid.two-cols,
  .form-grid.three-cols { grid-template-columns: 1fr; }
}

.display-toolbar {
  display: grid;
  gap: 12px;
}

.segmented,
.field-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented label,
.field-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 650;
}

.segmented input,
.field-picker input { width: auto; }

.item-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.item-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.item-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.empty-card-image {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.item-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.item-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-fields {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.module-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.module-category-card {
  display: grid;
  gap: 16px;
}

.category-actions {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.inline-form label {
  display: grid;
  gap: 6px;
}

.inline-form input[type="hidden"] {
  display: none;
}

@media (max-width: 760px) {
  .inline-form { grid-template-columns: 1fr; }
}

/* Dashboard analytics */
.dashboard-summary .stat-card { min-height: 112px; }
.analytics-grid { align-items: start; }
.chart-panel { min-height: 360px; }
.status-chart, .category-chart { display: grid; gap: 16px; }
.status-row, .category-stat-row { display: grid; gap: 8px; }
.status-meta, .category-stat-label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}
.category-stat-label { grid-template-columns: 1fr auto; }
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot-color);
}
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--bar-color);
}
.category-fill { background: linear-gradient(90deg, #0f766e, #14b8a6); }
/* Navigation management */
.nav-section-title {
  margin: 26px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.nav-section-title:first-of-type { margin-top: 0; }
.nav-section-title h2 {
  margin-bottom: 4px;
  font-size: 20px;
  line-height: 1.25;
  color: #111827;
}
.nav-section-title p { margin-bottom: 0; font-size: 14px; }
.nav-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}
.nav-admin-panel, .nav-create-panel { min-width: 0; }
.subtle-panel-head { margin-bottom: 12px; }
.subtle-panel-head h2 {
  font-size: 15px;
  color: #344054;
  font-weight: 800;
}
.nav-admin-list { display: grid; gap: 10px; }
.nav-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcfe;
}
.module-edit-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 120px 88px 170px;
  gap: 10px;
  align-items: end;
}
.module-edit-form label, .module-create-form label, .nav-action-forms label {
  font-size: 13px;
  line-height: 1.3;
  color: #667085;
  font-weight: 700;
}
.module-edit-form input, .module-create-form input, .nav-action-forms input, .nav-action-forms select {
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
}

.nav-structure-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.nav-structure-card {
  display: grid;
  gap: 16px;
  padding: 16px;
}
.module-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f7;
}
.module-card-head div { display: grid; gap: 3px; }
.module-card-head h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
}
.module-card-head span {
  color: #98a2b3;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}
.nav-tree-admin { display: grid; gap: 8px; }
.nav-tree-root {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}
.nav-tree-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
}
.nav-tree-line span {
  color: #344054;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}
.level-two-line span::before {
  content: "二级";
  display: inline-flex;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
}
.level-three-line {
  margin-left: 14px;
  padding-left: 12px;
  border-left: 2px solid #e5e7eb;
}
.level-three-line span {
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}
.level-three-line span::before {
  content: "三级";
  display: inline-flex;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
}
.nav-action-forms {
  display: grid;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.compact-empty { min-height: 72px; }

@media (max-width: 1020px) {
  .nav-admin-layout { grid-template-columns: 1fr; }
  .module-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .nav-admin-row { grid-template-columns: 1fr; }
  .module-edit-form { grid-template-columns: 1fr; }
  .nav-structure-grid { grid-template-columns: 1fr; }
}

/* Refined controls */
.soft-save {
  background: #eef4ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
}
.soft-save:hover { background: #dbeafe; }
.soft-save.saved {
  background: #ecfdf3;
  color: #027a48;
}
.module-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  padding-bottom: 8px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}
.module-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.module-toggle span {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d0d5dd;
  position: relative;
  transition: background 0.18s ease;
}
.module-toggle span::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
  transition: transform 0.18s ease;
}
.module-toggle input:checked + span { background: #2563eb; }
.module-toggle input:checked + span::after { transform: translateX(14px); }
.module-toggle em { font-style: normal; }
.module-key-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #047857;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}
.module-card-head p {
  margin: 0;
  color: #98a2b3;
  font-size: 13px;
  font-weight: 600;
}
.member-editor-panel {
  max-width: 860px;
  padding: 24px;
}
.member-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.member-form-grid .span-all { grid-column: 1 / -1; }
.role-help {
  display: block;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 600;
}
@media (max-width: 720px) {
  .member-form-grid { grid-template-columns: 1fr; }
}

/* Member management redesign */
.member-table .avatar-thumb, .avatar-thumb {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}
.avatar-fallback {
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: #2563eb;
  font-weight: 900;
}
.member-editor-shell { max-width: 1040px; }
.member-editor-form {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.member-avatar-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  justify-items: center;
  gap: 14px;
}
.avatar-large-wrap { width: 156px; height: 156px; }
.avatar-large {
  width: 156px;
  height: 156px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #d9dee7;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}
.avatar-large-fallback {
  display: grid;
  place-items: center;
  background: #eef4ff;
  color: #2563eb;
  font-size: 42px;
  font-weight: 900;
}
.avatar-upload {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
}
.avatar-upload input { display: none; }
.member-form-main {
  display: grid;
  gap: 16px;
}
.member-form-main .form-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.role-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.role-info-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
}
.role-info-grid strong { color: #1f2937; font-size: 14px; }
.role-info-grid span { color: #475467; font-size: 13px; line-height: 1.5; }
.module-row-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  align-self: end;
  padding-bottom: 0;
}
.module-row-controls .module-toggle { padding-bottom: 0; }
.module-row-controls .soft-save { min-height: 40px; }
@media (max-width: 860px) {
  .member-editor-form { grid-template-columns: 1fr; }
  .member-avatar-panel { justify-items: start; }
  .role-info-grid { grid-template-columns: 1fr; }
}

/* System settings and login security */
.auth-page-image {
  background: linear-gradient(rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.35)), var(--login-bg) center / cover no-repeat fixed;
}
.auth-page-image .auth-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
}
.captcha-question {
  display: inline-flex;
  width: fit-content;
  margin: 2px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f2f4f7;
  color: #344054;
  font-size: 14px;
  font-weight: 900;
}
.settings-panel { max-width: 920px; }
.settings-form { display: grid; gap: 18px; }
.settings-bg-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}
.login-bg-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.empty-bg-preview {
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
}
@media (max-width: 720px) {
  .settings-bg-grid { grid-template-columns: 1fr; }
}

/* Global feedback and topbar avatar */
.toast {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 11px 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  transition: opacity 0.22s ease, transform 0.22s ease, margin 0.22s ease, padding 0.22s ease, border-width 0.22s ease;
}
.toast.toast-hiding {
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  opacity: 0;
  transform: translateY(-4px);
}
.success-toast { background: #ecfdf3; color: #027a48; border-color: #abefc6; }
.error-toast { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.topbar-avatar.avatar-fallback { display: grid; place-items: center; background: #eef4ff; color: #2563eb; font-size: 14px; }
.disabled-action { opacity: 0.62; cursor: not-allowed; }

/* Navigation row alignment polish */
.nav-admin-row > form:not(.module-edit-form), .nav-admin-row > .disabled-action {
  align-self: end;
  min-height: 40px;
  margin-bottom: 0;
}
.nav-admin-row > form:not(.module-edit-form) button { min-height: 40px; }
.module-edit-form { align-items: end; }
.module-row-controls { min-height: 40px; }

/* Compact field selector */
.display-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.field-select-menu {
  position: relative;
  justify-self: end;
}
.field-select-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.field-select-menu summary::-webkit-details-marker { display: none; }
.field-select-menu summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.field-select-menu[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.field-select-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(360px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(31, 41, 51, 0.14);
}
.field-select-panel label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #fbfcfe;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}
.field-select-panel input { width: auto; }
.field-select-panel button {
  grid-column: 1 / -1;
  min-height: 38px;
}
.disabled-action {
  min-width: 52px;
  text-align: center;
}
@media (max-width: 640px) {
  .display-toolbar { align-items: stretch; }
  .field-select-menu { width: 100%; }
  .field-select-menu summary { justify-content: center; width: 100%; }
  .field-select-panel { left: 0; right: auto; width: 100%; }
}

/* Visual polish pass */
:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #e1e7ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar: #0b1220;
  --sidebar-soft: #172033;
  --sidebar-text: #e6edf7;
}
body {
  background: radial-gradient(circle at top left, #eef6ff 0, #f3f6fb 320px, #f3f6fb 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
  padding: 18px 14px;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
}
.brand {
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand strong { font-size: 19px; letter-spacing: 0; }
.brand span { color: #94a3b8; font-size: 12px; font-weight: 700; }
.side-nav { gap: 5px; }
.nav-link, .nav-summary, .sub-link, .third-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-link, .nav-summary { padding: 0 10px; font-size: 14px; font-weight: 800; }
.nav-link:hover, .nav-summary:hover, .sub-link:hover, .third-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}
.nav-link.active, .nav-summary.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}
.nav-collapse summary { cursor: pointer; list-style: none; }
.nav-collapse summary::-webkit-details-marker { display: none; }
.nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: currentColor;
  opacity: 0.95;
}
.sub-nav {
  display: grid;
  gap: 4px;
  margin: 5px 0 8px 11px;
  padding-left: 10px;
  border-left: 1px solid rgba(148, 163, 184, 0.24);
}
.sub-link { padding: 0 9px; min-height: 34px; font-size: 13px; font-weight: 750; color: #aebbd0; }
.sub-link.active { background: rgba(37, 99, 235, 0.18); color: #dbeafe; }
.third-nav { display: grid; gap: 3px; margin: 4px 0 8px 15px; }
.third-link { padding: 0 8px; min-height: 30px; font-size: 12px; font-weight: 700; color: #94a3b8; }
.third-link.active { color: #ffffff; background: rgba(255, 255, 255, 0.08); }
.topbar {
  min-height: 64px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(225, 231, 239, 0.9);
}
.topbar-title strong { font-size: 17px; color: #111827; }
.container { width: min(1220px, calc(100% - 48px)); padding: 30px 0 52px; }
.page-title { margin-bottom: 22px; }
.page-title h1 { font-size: 26px; line-height: 1.2; color: #111827; }
.page-title p { font-size: 14px; margin-bottom: 0; }
.panel, .stat-card {
  border-color: rgba(225, 231, 239, 0.95);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}
.stat-card { min-height: 116px; }
.stat-card span { color: #667085; font-size: 13px; font-weight: 800; }
.stat-card strong { color: #111827; font-size: 32px; }
button, .button-link { border-radius: 8px; font-weight: 800; }
input, select, textarea {
  border-color: #d0d7e2;
  border-radius: 8px;
  background: #ffffff;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.12);
  border-color: #2563eb;
}
.data-table th { background: #f8fafc; color: #475467; font-size: 12px; letter-spacing: 0; }
.data-table td { color: #344054; }
.toast { box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05); }
@media (max-width: 860px) {
  .sidebar { position: static; height: auto; }
  .app-shell { grid-template-columns: 1fr; }
}

/* Configurable navigation icons */
.icon-select { min-width: 112px; }
.module-key-badge {
  gap: 6px;
}
.module-badge-icon {
  width: 13px;
  height: 13px;
  fill: currentColor;
  flex: 0 0 13px;
}
@media (max-width: 1020px) {
  .module-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Visual icon picker */
.icon-picker-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #667085;
  font-weight: 700;
  position: relative;
}
.icon-picker { position: relative; }
.icon-picker summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  width: 100%;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
}
.icon-picker summary::-webkit-details-marker { display: none; }
.icon-picker summary svg, .icon-option svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.icon-picker summary em, .icon-option em { font-style: normal; }
.icon-picker-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}
.icon-option { display: block; }
.icon-option input { position: absolute; opacity: 0; pointer-events: none; }
.icon-option span {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 62px;
  padding: 8px 6px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  color: #475467;
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.icon-option input:checked + span {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.module-create-form .span-all { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .icon-picker-panel { width: min(300px, calc(100vw - 48px)); }
}

/* Search statistics redesign */
.search-overview {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(150px, 0.6fr));
  gap: 14px;
  margin-bottom: 18px;
}
.search-total-card, .search-mini-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}
.search-total-card {
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #ffffff;
}
.search-total-card span, .search-mini-card span { font-size: 13px; font-weight: 850; opacity: 0.82; }
.search-total-card strong { display: block; margin: 10px 0 6px; font-size: 42px; line-height: 1; }
.search-total-card p { margin: 0; opacity: 0.86; font-size: 13px; }
.search-mini-card { display: grid; align-content: center; gap: 10px; }
.search-mini-card strong { font-size: 28px; line-height: 1; color: #111827; }
.search-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.search-stat-panel { padding: 16px; min-width: 0; }
.search-stat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-stat-head h2 { font-size: 15px; color: #111827; }
.stat-head-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
}
.search-stat-list { display: grid; gap: 8px; }
.search-stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
  font-weight: 750;
}
.search-stat-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-stat-row strong { color: #111827; font-size: 15px; }
@media (max-width: 1180px) {
  .search-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .search-overview, .search-stat-grid { grid-template-columns: 1fr; }
}
/* Larger offline icon picker */
.icon-picker-panel {
  width: 430px;
  max-height: 360px;
  overflow: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .icon-picker-panel { width: min(430px, calc(100vw - 48px)); grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Editable second/third-level nav rows */
.editable-nav-line { align-items: center; }
.nav-level-edit-form {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 90px auto;
  gap: 8px;
  align-items: center;
  flex: 1;
}
.nav-level-edit-form input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}
.compact-icon-picker { gap: 0; }
.compact-icon-picker .icon-picker summary {
  min-height: 34px;
  font-size: 12px;
}
.compact-icon-picker .icon-picker-panel {
  width: 360px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.nav-level-edit-form .soft-save {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
@media (max-width: 720px) {
  .nav-level-edit-form { grid-template-columns: 1fr; }
}

/* Icon picker usability fix */
.icon-picker-panel {
  width: 440px;
  max-width: min(440px, calc(100vw - 56px));
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.icon-picker-close {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d0d7e2;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
}
.icon-picker-close:hover { background: #f8fafc; color: #111827; }
.icon-option span { min-width: 0; }
.icon-option em { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .icon-picker-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Login page polish */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f2fe 0%, #eef2ff 48%, #f8fafc 100%);
}
.auth-page-image {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.68), rgba(15, 23, 42, 0.18)), var(--login-bg) center / cover no-repeat fixed;
}
.login-card {
  width: min(100%, 460px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}
.login-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 28px 28px 18px;
  border-bottom: 1px solid rgba(225, 231, 239, 0.8);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.72));
}
.login-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.28);
}
.login-head h1 { margin: 0 0 5px; font-size: 24px; color: #111827; }
.login-head p { margin: 0; color: #667085; font-size: 14px; line-height: 1.5; }
.login-form { padding: 22px 28px 28px; gap: 15px; }
.login-form label { color: #344054; font-size: 14px; }
.login-form input { min-height: 44px; background: rgba(255, 255, 255, 0.94); }
.captcha-field { gap: 8px; }
.captcha-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.captcha-question {
  min-height: 44px;
  margin: 0;
  align-items: center;
  padding: 0 14px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}
.login-form button { min-height: 46px; margin-top: 4px; }
.login-card .alert { margin: 16px 28px 0; }
@media (max-width: 520px) {
  .login-head { padding: 22px 22px 16px; }
  .login-form { padding: 20px 22px 24px; }
  .captcha-row { grid-template-columns: 1fr; }
  .captcha-question { justify-content: center; }
}

/* Final compact icon picker and search/dashboard polish */
.icon-picker-panel {
  width: 348px;
  max-width: min(348px, calc(100vw - 56px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  max-height: 380px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.icon-picker-close {
  order: -1;
  position: sticky;
  top: 0;
  z-index: 2;
  grid-column: 1 / -1;
  background: #f8fafc;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.06);
}
.icon-option span {
  min-height: 58px;
  padding: 7px 4px;
}
.icon-option svg {
  width: 17px;
  height: 17px;
}
.compact-icon-picker .icon-picker-panel {
  width: 348px;
  max-width: min(348px, calc(100vw - 56px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.field-select-menu summary {
  background: #ffffff;
  color: #175cd3;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.field-select-panel {
  width: min(300px, calc(100vw - 40px));
  grid-template-columns: 1fr;
}
.field-select-panel label {
  justify-content: flex-start;
  background: #ffffff;
}
.search-overview {
  grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(145px, 0.55fr));
}
.search-total-card {
  position: relative;
  overflow: hidden;
  border: 0;
  background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
}
.search-total-card::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -42px;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  border: 28px solid rgba(255, 255, 255, 0.12);
}
.search-mini-card {
  border-top: 4px solid #2563eb;
}
.search-mini-card:nth-child(3) { border-top-color: #0f766e; }
.search-mini-card:nth-child(4) { border-top-color: #7c3aed; }
.search-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.search-stat-panel {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}
.search-stat-head {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f7;
  background: #fbfcfe;
}
.search-stat-list {
  padding: 12px;
}
.search-stat-row {
  position: relative;
  min-height: 38px;
  padding-left: 14px;
  background: linear-gradient(90deg, #eff6ff 0, #f8fafc 100%);
}
.search-stat-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: #2563eb;
}
.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
}
.auth-page-image .login-card {
  margin-left: min(8vw, 96px);
  justify-self: start;
}
.login-card {
  border-radius: 16px;
}
.login-head {
  align-items: flex-start;
  padding-bottom: 20px;
}
.login-mark {
  flex: 0 0 46px;
}
.captcha-row {
  grid-template-columns: minmax(126px, auto) minmax(120px, 1fr);
}
.captcha-question {
  display: inline-flex;
  border-radius: 8px;
  font-weight: 850;
}
@media (max-width: 720px) {
  .icon-picker-panel,
  .compact-icon-picker .icon-picker-panel {
    width: min(348px, calc(100vw - 44px));
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .search-overview { grid-template-columns: 1fr; }
  .auth-page-image .login-card { margin-left: 0; justify-self: center; }
}
@media (max-width: 420px) {
  .icon-picker-panel,
  .compact-icon-picker .icon-picker-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Request polish: login, nav hierarchy, dashboard amount, owner picker */
.login-head {
  display: block;
}
.login-head h1 {
  font-size: 26px;
}
.login-head p {
  max-width: 34em;
}

.nav-tree-line.editable-nav-line {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.nav-tree-line.editable-nav-line::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 22px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
}
.level-two-line.editable-nav-line::before {
  content: "二级";
  background: #dbeafe;
  color: #1d4ed8;
}
.level-three-line.editable-nav-line::before {
  content: "三级";
  background: #f2f4f7;
  color: #475467;
}
.nav-tree-line.editable-nav-line {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}
.nav-level-edit-form {
  grid-column: 2;
}
.nav-tree-line.editable-nav-line > form:last-child {
  grid-column: 3;
}
.level-two-line .nav-level-edit-form input[name="name"] {
  color: #111827;
  font-size: 14px;
  font-weight: 850;
}
.level-three-line .nav-level-edit-form input[name="name"] {
  color: #475467;
  font-size: 13px;
  font-weight: 750;
}
.level-two-line span::before,
.level-three-line span::before {
  content: none;
}

.nav-action-forms .inline-form {
  position: relative;
  grid-template-columns: 72px minmax(180px, 1fr) auto;
  align-items: end;
  padding: 34px 10px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}
.nav-action-forms .inline-form::before {
  position: absolute;
  left: 10px;
  top: 10px;
  color: #111827;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 900;
}
.nav-action-forms .inline-form:nth-child(1)::before { content: "新增二级导航"; }
.nav-action-forms .inline-form:nth-child(2)::before { content: "新增三级导航"; }
.nav-action-forms .icon-picker-field > span,
.nav-action-forms .icon-picker summary em {
  display: none;
}
.nav-action-forms .icon-picker summary {
  width: 48px;
  min-height: 42px;
  padding: 0;
}
.nav-action-forms .icon-picker summary svg {
  width: 18px;
  height: 18px;
}
.nav-action-forms button[type="submit"] {
  min-width: 68px;
  min-height: 42px;
}
@media (max-width: 760px) {
  .nav-tree-line.editable-nav-line {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .nav-tree-line.editable-nav-line > form:last-child {
    grid-column: 2;
    justify-self: start;
  }
  .nav-action-forms .inline-form {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .nav-action-forms .inline-form label,
  .nav-action-forms .inline-form button[type="submit"] {
    grid-column: 1 / -1;
  }
}

.owner-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}
.owner-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}
.owner-check-item input {
  width: auto;
}
.owner-check-item:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #175cd3;
}
.amount-card strong {
  font-size: 26px;
}
.owner-amount-list {
  display: grid;
  gap: 10px;
}
.owner-amount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #fbfcfe;
}
.owner-amount-row div {
  display: grid;
  gap: 3px;
}
.owner-amount-row strong {
  color: #111827;
  font-size: 14px;
}
.owner-amount-row span {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}
.owner-amount-row em {
  color: #0f766e;
  font-style: normal;
  font-size: 16px;
  font-weight: 900;
}

/* Strict layout fix: search statistics and navigation config */
.search-filter-grid {
  grid-template-columns: minmax(320px, 1.7fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
.search-keyword-field {
  grid-column: span 2;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  color: #175cd3;
}
.search-keyword-field input {
  min-height: 46px;
  border-color: #93c5fd;
  font-size: 15px;
  font-weight: 750;
  background: #ffffff;
}
.search-keyword-field input::placeholder {
  color: #667085;
  font-weight: 600;
}
.search-filter-grid .form-actions {
  align-self: stretch;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.search-filter-grid .form-actions button,
.search-filter-grid .form-actions .button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 980px) {
  .search-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-keyword-field { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .search-filter-grid { grid-template-columns: 1fr; }
}

.module-edit-form {
  grid-template-columns: 82px minmax(160px, 1.2fr) 118px 88px 170px;
}
.module-key-inline,
.module-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #175cd3 !important;
  border: 1px solid #c7d7fe;
  font-size: 12px !important;
  line-height: 1;
  font-weight: 900 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-key-inline {
  align-self: end;
  margin-bottom: 2px;
}
.module-card-head .module-key-badge {
  flex: 0 1 auto;
  min-width: 0;
}
.module-badge-icon {
  width: 14px;
  height: 14px;
}
.nav-tree-line.editable-nav-line {
  grid-template-columns: 54px minmax(0, 1fr) 52px;
  column-gap: 10px;
  min-height: 42px;
}
.nav-tree-line.editable-nav-line::before {
  width: 42px;
  height: 24px;
  min-height: 24px;
  justify-self: center;
  border-radius: 999px;
  box-sizing: border-box;
}
.level-two-line.editable-nav-line::before {
  border: 1px solid #bfdbfe;
}
.level-three-line.editable-nav-line::before {
  border: 1px solid #e4e7ec;
}
.nav-level-edit-form {
  grid-template-columns: minmax(120px, 1fr) 82px 54px;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.nav-level-edit-form input[name="name"] {
  min-width: 0;
}
.compact-icon-picker .icon-picker summary {
  width: 82px;
  min-height: 36px;
  padding: 0 8px;
}
.nav-level-edit-form .soft-save,
.nav-tree-line.editable-nav-line .link-button {
  width: 52px;
  min-width: 52px;
  min-height: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.nav-tree-line.editable-nav-line .link-button {
  color: #be123c;
  border: 1px solid #fecdd3;
  background: #fff1f2;
}
.nav-tree-line.editable-nav-line > form:last-child {
  justify-self: end;
  align-self: center;
}

.nav-action-forms {
  gap: 12px;
}
.nav-action-forms .inline-form {
  gap: 10px;
  padding: 38px 12px 12px;
}
.nav-action-forms .add-secondary-form {
  grid-template-columns: 56px minmax(0, 1fr) 72px;
}
.nav-action-forms .add-tertiary-form {
  grid-template-columns: 56px minmax(0, 1fr) 72px;
}
.nav-action-forms .add-tertiary-form .parent-select-field {
  grid-column: 1 / -1;
}
.nav-action-forms .add-tertiary-form .icon-picker-field {
  grid-column: 1;
  grid-row: 3;
}
.nav-action-forms .add-tertiary-form .nav-new-name {
  grid-column: 2;
  grid-row: 3;
}
.nav-action-forms .add-tertiary-form button[type="submit"] {
  grid-column: 3;
  grid-row: 3;
}
.nav-action-forms .icon-picker-field {
  align-self: end;
}
.nav-action-forms .icon-picker summary {
  width: 46px;
  min-width: 46px;
  height: 42px;
  min-height: 42px;
  border-radius: 8px;
}
.nav-action-forms label span {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}
.nav-action-forms button[type="submit"] {
  width: 72px;
  min-width: 72px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-action-forms select,
.nav-action-forms input[name="name"] {
  min-height: 42px;
}
@media (max-width: 1020px) {
  .module-edit-form { grid-template-columns: 82px repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .module-edit-form { grid-template-columns: 1fr; }
  .module-key-inline { justify-self: start; }
  .nav-level-edit-form { grid-template-columns: 1fr; }
  .nav-tree-line.editable-nav-line { grid-template-columns: 54px minmax(0, 1fr); }
  .nav-level-edit-form { grid-column: 2; }
  .nav-tree-line.editable-nav-line > form:last-child { grid-column: 2; justify-self: start; }
  .nav-action-forms .add-secondary-form,
  .nav-action-forms .add-tertiary-form { grid-template-columns: 52px minmax(0, 1fr); }
  .nav-action-forms .add-secondary-form button[type="submit"],
  .nav-action-forms .add-tertiary-form button[type="submit"] { grid-column: 1 / -1; width: 100%; }
}

/* Layout redesign: search top and module category editor */
.search-filter-panel {
  padding: 0;
  overflow: visible;
  border-radius: 12px;
}
.search-filter-form {
  display: grid;
  gap: 0;
}
.search-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef2f7;
  background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
}
.search-filter-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
  color: #111827;
}
.search-filter-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  font-weight: 650;
}
.search-filter-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-filter-actions button,
.search-filter-actions .button-link {
  min-width: 74px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-keyword-field {
  display: grid;
  gap: 8px;
  margin: 18px 18px 12px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #175cd3;
  font-size: 14px;
  font-weight: 900;
}
.search-keyword-field input {
  min-height: 48px;
  border-color: #93c5fd;
  font-size: 16px;
  font-weight: 760;
}
.search-filter-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  padding: 0 18px 18px;
}
.search-filter-fields label {
  min-width: 0;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}
.search-filter-fields select {
  min-height: 40px;
  font-size: 14px;
  font-weight: 650;
}
.search-overview-redesign {
  grid-template-columns: minmax(260px, 1.35fr) repeat(3, minmax(140px, 0.65fr));
  gap: 12px;
  margin-top: 16px;
}
.search-overview-redesign .search-total-card,
.search-overview-redesign .search-mini-card {
  border-radius: 12px;
}
.search-overview-redesign .search-mini-card {
  min-height: 104px;
  padding: 16px;
}
@media (max-width: 1180px) {
  .search-filter-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-overview-redesign { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .search-filter-head { align-items: stretch; flex-direction: column; }
  .search-filter-actions { display: grid; grid-template-columns: 1fr auto; }
  .search-filter-fields, .search-overview-redesign { grid-template-columns: 1fr; }
}

.nav-structure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.nav-structure-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas:
    "head add"
    "tree add";
  gap: 16px;
  align-items: start;
  padding: 16px;
}
.nav-structure-card .module-card-head {
  grid-area: head;
  min-width: 0;
}
.nav-structure-card .module-existing-nav {
  grid-area: tree;
  min-width: 0;
}
.nav-structure-card .module-add-nav {
  grid-area: add;
  min-width: 0;
  align-self: stretch;
}
.module-card-head {
  min-height: 44px;
}
.nav-tree-root {
  display: grid;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.nav-tree-line.editable-nav-line {
  display: grid !important;
  grid-template-columns: 48px minmax(240px, 1fr) 58px !important;
  gap: 10px !important;
  align-items: center !important;
  min-width: 560px;
  min-height: 44px;
  padding: 0;
}
.nav-tree-line.editable-nav-line::before {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  height: 24px;
  min-height: 24px;
  justify-self: center;
  align-self: center;
}
.nav-tree-line.editable-nav-line .nav-level-edit-form {
  grid-column: 2 !important;
  grid-row: 1;
  display: grid !important;
  grid-template-columns: minmax(180px, 1fr) 86px 58px !important;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.nav-tree-line.editable-nav-line > form:last-child {
  grid-column: 3 !important;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  margin: 0;
}
.nav-level-edit-form input[name="name"] {
  height: 36px;
  min-height: 36px;
  min-width: 0;
}
.compact-icon-picker .icon-picker summary {
  width: 86px;
  height: 36px;
  min-height: 36px;
}
.nav-level-edit-form .soft-save,
.nav-tree-line.editable-nav-line .link-button {
  width: 58px !important;
  min-width: 58px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 13px;
}
.level-three-line {
  margin-left: 24px;
  min-width: 536px !important;
}
.nav-action-forms.module-add-nav {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
}
.nav-action-forms .add-secondary-form,
.nav-action-forms .add-tertiary-form {
  display: grid !important;
  position: relative;
  gap: 10px;
  padding: 38px 12px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}
.nav-action-forms .add-secondary-form {
  grid-template-columns: 48px minmax(0, 1fr) 70px !important;
}
.nav-action-forms .add-tertiary-form {
  grid-template-columns: 48px minmax(0, 1fr) 70px !important;
}
.nav-action-forms .add-tertiary-form .parent-select-field {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
}
.nav-action-forms .add-tertiary-form .icon-picker-field {
  grid-column: 1 !important;
  grid-row: 2 !important;
}
.nav-action-forms .add-tertiary-form .nav-new-name {
  grid-column: 2 !important;
  grid-row: 2 !important;
}
.nav-action-forms .add-tertiary-form button[type="submit"] {
  grid-column: 3 !important;
  grid-row: 2 !important;
}
.nav-action-forms .icon-picker summary {
  width: 46px !important;
  min-width: 46px !important;
  height: 42px !important;
}
.nav-action-forms button[type="submit"] {
  width: 70px !important;
  min-width: 70px !important;
  height: 42px !important;
  padding: 0 !important;
}
@media (max-width: 1120px) {
  .nav-structure-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "tree"
      "add";
  }
}

/* Unified nav add panel and login remember option */
.nav-global-add-panel {
  margin-bottom: 18px;
  padding: 16px;
}
.nav-global-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.nav-global-add-grid .inline-form {
  display: grid;
  position: relative;
  gap: 10px;
  padding: 38px 12px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcfe;
}
.nav-global-add-grid .inline-form::before {
  position: absolute;
  left: 12px;
  top: 11px;
  color: #111827;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}
.nav-global-add-grid .add-secondary-form::before { content: "新增二级导航"; }
.nav-global-add-grid .add-tertiary-form::before { content: "新增三级导航"; }
.nav-global-add-grid .add-secondary-form {
  grid-template-columns: minmax(120px, 0.8fr) 48px minmax(140px, 1fr) 88px;
}
.nav-global-add-grid .add-tertiary-form {
  grid-template-columns: 48px minmax(150px, 1fr) 88px;
}
.nav-global-add-grid .add-tertiary-form .parent-select-field {
  grid-column: 1 / -1;
}
.nav-global-add-grid .add-tertiary-form .icon-picker-field { grid-column: 1; }
.nav-global-add-grid .add-tertiary-form .nav-new-name { grid-column: 2; }
.nav-global-add-grid .add-tertiary-form button[type="submit"] { grid-column: 3; }
.nav-global-add-grid label span,
.nav-global-add-grid .icon-picker-field > span {
  display: block;
  margin-bottom: 6px;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}
.nav-global-add-grid .icon-picker summary em { display: none; }
.nav-global-add-grid .icon-picker summary {
  width: 46px;
  min-width: 46px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}
.nav-global-add-grid button[type="submit"] {
  width: 88px;
  min-width: 88px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-global-add-grid select,
.nav-global-add-grid input[name="name"] {
  min-height: 42px;
}
.nav-structure-card {
  grid-template-columns: 1fr;
  grid-template-areas:
    "head"
    "tree";
}
.nav-structure-card .module-add-nav { display: none !important; }
@media (max-width: 1100px) {
  .nav-global-add-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-global-add-grid .add-secondary-form,
  .nav-global-add-grid .add-tertiary-form {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .nav-global-add-grid .module-select-field,
  .nav-global-add-grid .parent-select-field,
  .nav-global-add-grid button[type="submit"] {
    grid-column: 1 / -1 !important;
    width: 100%;
  }
}
.remember-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: #475467 !important;
  font-size: 13px !important;
  font-weight: 750 !important;
}
.remember-row input {
  width: 16px !important;
  height: 16px;
  min-height: 16px !important;
  margin: 0;
}
.remember-row span { line-height: 1.2; }

/* Required fields and view switch behavior */
.required-star {
  color: #dc2626;
  font-weight: 900;
  margin-left: 2px;
}
.required-label {
  color: #344054;
}
.segmented input[onchange] {
  cursor: pointer;
}

/* Required label color and item pagination */
.required-star { display: none; }
.required-text {
  color: #b42318;
  font-weight: 900;
}
.required-label input,
.required-label select,
.required-label textarea,
.required-label .owner-check-grid {
  margin-top: 8px;
}
.per-page-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}
.per-page-control select {
  min-height: 38px;
  min-width: 96px;
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}
.pagination-bar div {
  display: flex;
  gap: 8px;
}
.pagination-bar button {
  min-height: 36px;
  padding: 0 12px;
}
.pagination-bar button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
@media (max-width: 640px) {
  .pagination-bar { align-items: stretch; flex-direction: column; }
  .pagination-bar div { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Pagination placement, row actions and image preview */
.display-toolbar .per-page-control { display: none; }
.pagination-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}
.pagination-bar > span {
  white-space: nowrap;
}
.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bottom-per-page {
  white-space: nowrap;
  justify-self: end;
}
.bottom-per-page select {
  flex: 0 0 auto;
}
.row-actions {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.row-actions a,
.row-actions .link-button {
  min-width: 42px;
  min-height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.upload-box.compact-upload {
  gap: 8px;
  cursor: pointer;
  background: #f8fafc;
}
.upload-box.compact-upload span {
  color: #111827;
  font-size: 14px;
  font-weight: 900;
}
.upload-box.compact-upload em {
  color: #667085;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}
.upload-box.compact-upload strong {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}
.upload-box.compact-upload input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.image-preview-trigger {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}
.image-preview-trigger:hover { background: transparent; }
.thumb-trigger { width: 56px; height: 56px; }
.card-image-trigger { width: 100%; }
.card-image-trigger .item-card-image { display: block; width: 100%; }
.image-preview .image-preview-trigger { width: 100%; }
.image-preview .image-preview-trigger img { display: block; }
.image-lightbox[hidden] { display: none; }
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.78);
}
.image-lightbox img {
  max-width: min(960px, 94vw);
  max-height: 86vh;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}
.image-lightbox-close {
  position: fixed;
  right: 24px;
  top: 20px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  line-height: 1;
}
@media (max-width: 760px) {
  .pagination-bar { grid-template-columns: 1fr; align-items: stretch; }
  .bottom-per-page { justify-self: stretch; justify-content: space-between; }
}

/* Final list actions, pagination order and multi-image upload controls */
.actions-col { width: 132px; text-align: center; }
.row-actions {
  display: grid !important;
  grid-template-columns: repeat(2, 46px);
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 104px;
}
.row-actions form { display: contents; }
.row-actions a,
.row-actions .link-button {
  width: 46px;
  min-width: 46px;
  height: 30px;
  min-height: 30px;
  padding: 0 !important;
  border-radius: 7px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}
.row-actions a { background: #eff6ff; color: #175cd3; }
.row-actions .link-button { background: #fff1f2; color: #be123c; }
.pagination-bar {
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
}
.pagination-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.pagination-controls .bottom-per-page {
  order: 1;
  flex: 0 0 auto;
}
.pagination-controls .pagination-actions {
  order: 2;
  flex: 0 0 auto;
}
.bottom-per-page {
  white-space: nowrap !important;
}
.bottom-per-page select {
  width: 88px;
  min-width: 88px;
}
.pagination-actions button {
  width: 64px;
  padding: 0 !important;
}
.existing-image-grid,
.pending-image-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pending-image-grid:empty { display: none; }
.image-preview {
  position: relative;
  overflow: hidden;
}
.image-remove-button {
  position: absolute;
  right: 6px;
  top: 6px;
  min-width: 38px;
  height: 24px;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(190, 18, 60, 0.94);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}
.image-remove-button:hover { background: #9f1239; }
.pending-image-item img,
.existing-image-item img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
}
@media (max-width: 760px) {
  .pagination-controls {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .pagination-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pagination-actions button { width: 100%; }
}

/* Final action buttons and image upload confirmation */
.row-actions {
  text-align: center !important;
  vertical-align: middle !important;
}
.action-button-group,
.card-actions {
  display: inline-grid;
  grid-template-columns: repeat(2, 48px);
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.action-button-group form,
.card-actions form { display: contents; }
.action-button-group a,
.action-button-group .link-button,
.card-actions a,
.card-actions .link-button {
  width: 48px;
  height: 32px;
  min-height: 32px;
  padding: 0 !important;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
}
.action-button-group a,
.card-actions a { background: #eff6ff; color: #175cd3; }
.action-button-group .link-button,
.card-actions .link-button { background: #fff1f2; color: #be123c; }
.card-actions {
  margin-top: 10px;
  justify-content: end;
}
.upload-file-store {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.upload-confirm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #175cd3;
  font-size: 13px;
  font-weight: 850;
}
.upload-confirm-row[hidden] { display: none; }
.upload-confirm-row button {
  width: 64px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}
.pending-image-status {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.76);
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
}
.pending-image-item.confirmed .pending-image-status { background: rgba(15, 118, 110, 0.9); }

/* Center table action cell and compact item editor sidebar */
td.row-actions {
  display: table-cell !important;
  text-align: center !important;
  vertical-align: middle !important;
  min-width: 116px;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
td.row-actions .action-button-group {
  margin: 0 auto;
  display: inline-grid !important;
  grid-template-columns: repeat(2, 48px);
  justify-content: center;
  align-items: center;
}
.item-editor {
  grid-template-columns: minmax(0, 1fr) 340px;
}
.editor-side {
  position: sticky;
  top: 76px;
  align-self: start;
  min-height: 0;
  padding: 14px;
  gap: 12px;
  border-left: 1px solid #e5e7eb;
  background: #f8fafc;
}
.editor-side .side-section {
  gap: 12px;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.035);
}
.editor-side .side-section h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: #111827;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
}
.editor-side .side-section h2::after {
  content: "";
  width: 32px;
  height: 3px;
  border-radius: 999px;
  background: #2563eb;
}
.editor-side .upload-box.compact-upload {
  min-height: 116px;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}
.editor-side .existing-image-grid,
.editor-side .pending-image-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.editor-side .owner-check-grid {
  grid-template-columns: 1fr;
  gap: 7px;
}
.editor-side .owner-check-item {
  min-height: 36px;
  border-radius: 8px;
}
.editor-actions {
  position: static;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.035);
}
.editor-actions button,
.editor-actions .button-link {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.editor-actions .secondary-link {
  margin: 0;
}
@media (max-width: 1080px) {
  .item-editor { grid-template-columns: 1fr; }
  .editor-side { position: static; border-left: 0; border-top: 1px solid var(--line); }
}

/* Colored item status badges and compact image remove icon */
.item-status-badge {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.item-status-badge.status-active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.item-status-badge.status-stored {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.item-status-badge.status-idle {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.item-status-badge.status-discarded {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.image-remove-button {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}


/* Member actions and dashboard tag layout polish */
.member-actions-col {
  width: 310px;
  text-align: center;
}
.member-actions-cell {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.member-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.member-action-group form { margin: 0; }
.member-action-group a,
.member-action-group .link-button {
  min-width: 52px;
  height: 32px;
  padding: 0 10px !important;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
}
.member-action-group a {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #175cd3;
}
.member-action-group .link-button {
  background: #fff1f2;
  border-color: #ffe4e6;
  color: #be123c;
}
.member-action-group form:last-child .link-button {
  min-width: 78px;
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475467;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.dashboard-total-card {
  min-height: 150px;
  padding: 22px 24px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 12px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 58%, #f0fdfa 100%);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}
.dashboard-total-card span,
.dashboard-total-card em {
  color: #667085;
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
}
.dashboard-total-card strong {
  color: #111827;
  font-size: 38px;
  line-height: 1.05;
}
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-kpi-grid .stat-card {
  min-height: 150px;
  justify-content: center;
}
.analytics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.chart-panel {
  min-height: 330px;
}
.status-chart,
.tag-chart,
.owner-amount-list {
  display: grid;
  gap: 14px;
}
.tag-fill {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}
.owner-amount-row {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #ffffff;
}
.owner-amount-row div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.owner-amount-row strong,
.owner-amount-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.owner-amount-row span {
  color: #667085;
  font-size: 12px;
  font-weight: 750;
}
.owner-amount-row em {
  color: #111827;
  font-style: normal;
  font-weight: 900;
}
@media (max-width: 1100px) {
  .dashboard-hero,
  .analytics-grid { grid-template-columns: 1fr; }
  .dashboard-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dashboard-kpi-grid { grid-template-columns: 1fr; }
  .member-actions-col { width: 190px; }
  .member-action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(72px, 1fr));
    gap: 6px;
    white-space: normal;
  }
  .member-action-group a,
  .member-action-group .link-button { width: 100%; }
  .member-action-group form:last-child { grid-column: 1 / -1; }
}



/* Member action modal */
.member-modal[hidden] { display: none; }
.member-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}
.member-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(5px);
}
.member-modal-card {
  position: relative;
  z-index: 1;
  width: min(410px, 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.18);
}
.member-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  font-size: 20px;
  line-height: 1;
  box-shadow: none;
}
.member-modal-close:hover {
  background: #f8fafc;
  color: #111827;
}
.member-modal-head {
  padding: 20px 52px 16px 20px;
  display: block;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}
.member-modal-head h2 {
  margin: 0 0 5px;
  color: #111827;
  font-size: 18px;
  line-height: 1.25;
}
.member-modal-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}
.member-modal-body {
  padding: 17px 20px 0;
  display: grid;
  gap: 10px;
}
.member-modal-field {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}
.member-modal-field[hidden],
.member-modal-note[hidden],
.member-modal-error[hidden] { display: none; }
.member-modal-field input {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
}
.member-modal-note {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}
.member-modal-error {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 800;
}
.member-modal-actions {
  margin-top: 18px;
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #ffffff;
}
.member-modal-actions button {
  min-width: 88px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
}
.member-modal-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: none;
}
.member-modal-primary.danger {
  background: #dc2626;
  color: #ffffff;
}
@media (max-width: 520px) {
  .member-modal { padding: 16px; }
  .member-modal-head { padding-left: 18px; }
  .member-modal-body { padding-left: 18px; padding-right: 18px; }
  .member-modal-actions { grid-template-columns: 1fr 1fr; display: grid; padding-left: 18px; padding-right: 18px; }
  .member-modal-actions button { width: 100%; }
}



/* Shared action confirm / notice modal */
.action-modal[hidden] { display: none; }
.action-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
}
.action-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(5px);
}
.action-modal-card {
  position: relative;
  z-index: 1;
  width: min(410px, 100%);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 54px rgba(15, 23, 42, 0.18);
}
.action-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  font-size: 20px;
  line-height: 1;
  box-shadow: none;
}
.action-modal-close:hover { background: #f8fafc; color: #111827; }
.action-modal-head {
  padding: 20px 52px 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}
.action-modal-head h2 {
  margin: 0 0 5px;
  color: #111827;
  font-size: 18px;
  line-height: 1.25;
}
.action-modal-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}
.action-modal-body {
  padding: 17px 20px 0;
  display: grid;
  gap: 10px;
}
.action-modal-note {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 800;
}
.action-modal-note[hidden] { display: none; }
.action-modal-actions {
  margin-top: 18px;
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #ffffff;
}
.action-modal-actions button {
  min-width: 88px;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
}
.action-modal-primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: none;
}
.action-modal-primary.danger {
  background: #dc2626;
  color: #ffffff;
}
@media (max-width: 520px) {
  .action-modal { padding: 16px; }
  .action-modal-head { padding-left: 18px; }
  .action-modal-body { padding-left: 18px; padding-right: 18px; }
  .action-modal-actions { grid-template-columns: 1fr 1fr; display: grid; padding-left: 18px; padding-right: 18px; }
  .action-modal-actions button { width: 100%; }
}


/* Stable item card columns */
.item-card-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1180px) {
  .item-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .item-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .item-card-grid { grid-template-columns: 1fr; }
}


/* Dashboard workbench additions */
.dashboard-workbench {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.dashboard-list-panel {
  min-height: 300px;
  display: grid;
  grid-template-rows: auto 1fr;
}
.dashboard-record-list,
.dashboard-todo-list {
  display: grid;
  gap: 10px;
  align-content: start;
}
.dashboard-record-row,
.dashboard-todo-row {
  min-height: 56px;
  padding: 11px 12px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
}
.dashboard-record-row:hover,
.dashboard-todo-row:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}
.dashboard-record-row div,
.dashboard-todo-row div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.dashboard-record-row strong,
.dashboard-record-row span,
.dashboard-todo-row span,
.dashboard-todo-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-record-row strong,
.dashboard-todo-row span {
  color: #111827;
  font-size: 14px;
  font-weight: 900;
}
.dashboard-record-row span,
.dashboard-todo-row em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}
.dashboard-record-row > em {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  color: #475467;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}
.dashboard-record-row.value-row > em {
  background: #ecfdf3;
  color: #047857;
}
.dashboard-todo-row {
  grid-template-columns: 52px minmax(0, 1fr);
}
.dashboard-todo-row > strong {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: #eff6ff;
  color: #175cd3;
  font-size: 20px;
  line-height: 1;
}
@media (max-width: 1100px) {
  .dashboard-workbench { grid-template-columns: 1fr; }
  .dashboard-list-panel { min-height: 0; }
}

/* Field selector and upload feedback refinements */
.field-select-panel .field-select-all {
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 8px;
  margin-bottom: 2px;
  color: #175cd3;
  font-weight: 900;
}
.upload-feedback {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #175cd3;
  font-size: 12px;
  font-weight: 800;
}
.upload-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}
.upload-progress i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transform: translateX(-110%);
}
.upload-feedback:not(.uploading) .upload-progress i {
  width: 100%;
  transform: none;
  background: #16a34a;
}
.upload-feedback.uploading .upload-progress i {
  animation: upload-progress-slide 1.1s ease-in-out infinite;
}
@keyframes upload-progress-slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(70%); }
  100% { transform: translateX(170%); }
}
.settings-bg-grid .upload-feedback { align-self: start; }

/* Sidebar independent scrolling */
@media (min-width: 861px) {
  .sidebar {
    overflow: hidden;
  }
  .sidebar .brand {
    flex: 0 0 auto;
  }
  .side-nav {
    min-height: 0;
    flex: 1 1 auto;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
  }
  .side-nav::-webkit-scrollbar {
    width: 6px;
  }
  .side-nav::-webkit-scrollbar-track {
    background: transparent;
  }
  .side-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.28);
  }
  .side-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.46);
  }
  .side-nav::after {
    content: "";
    display: block;
    height: 12px;
  }
}

/* Stronger field select all and unified access error page */
.field-select-panel .field-select-all {
  grid-column: 1 / -1;
  min-height: 36px;
  justify-content: flex-start;
  background: #eff6ff;
  border-color: #bfdbfe;
}
.error-state-panel {
  min-height: calc(100vh - 148px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}
.error-state-card {
  width: min(520px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  text-align: center;
}
.error-state-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 22px;
  font-weight: 900;
}
.error-state-card h1 {
  margin: 0;
  color: #111827;
  font-size: 22px;
}
.error-state-card p {
  margin: 0;
  color: #344054;
  font-weight: 800;
}
.error-state-card span {
  color: #667085;
  font-size: 13px;
}
.error-state-actions {
  margin-top: 8px;
}
.nav-summary.nested-summary.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Dashboard clickable stat rows */
a.owner-amount-row,
a.status-row,
a.category-stat-row {
  color: inherit;
  text-decoration: none;
}
a.owner-amount-row:hover,
a.status-row:hover,
a.category-stat-row:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

/* Topbar user dropdown and cascading nav create form */
.topbar-user-menu {
  position: relative;
}
.topbar-user-menu summary {
  list-style: none;
}
.topbar-user-menu summary::-webkit-details-marker { display: none; }
.topbar-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
}
.topbar-user-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid #667085;
  border-bottom: 2px solid #667085;
  transform: rotate(45deg) translateY(-2px);
}
.topbar-user-menu[open] .topbar-user-trigger::after {
  transform: rotate(225deg) translateY(-1px);
}
.topbar-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 148px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}
.topbar-user-dropdown a,
.topbar-user-dropdown button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.topbar-user-dropdown a:hover,
.topbar-user-dropdown button:hover {
  background: #eff6ff;
  color: #175cd3;
}
.nav-global-add-grid .add-tertiary-form {
  grid-template-columns: minmax(120px, 0.8fr) minmax(150px, 1fr) 48px minmax(140px, 1fr) 88px;
}
.nav-global-add-grid .add-tertiary-form .module-select-field { grid-column: 1; }
.nav-global-add-grid .add-tertiary-form .parent-select-field { grid-column: 2; }
.nav-global-add-grid .add-tertiary-form .icon-picker-field { grid-column: 3; }
.nav-global-add-grid .add-tertiary-form .nav-new-name { grid-column: 4; }
.nav-global-add-grid .add-tertiary-form button[type="submit"] { grid-column: 5; }
@media (max-width: 1180px) {
  .nav-global-add-grid .add-tertiary-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav-global-add-grid .add-tertiary-form .module-select-field,
  .nav-global-add-grid .add-tertiary-form .parent-select-field,
  .nav-global-add-grid .add-tertiary-form .icon-picker-field,
  .nav-global-add-grid .add-tertiary-form .nav-new-name,
  .nav-global-add-grid .add-tertiary-form button[type="submit"] { grid-column: auto; }
}

/* Navigation icon picker redesign */
.nav-structure-card,
.nav-tree-admin,
.editable-nav-line,
.nav-level-edit-form,
.compact-icon-picker,
.compact-icon-picker .icon-picker {
  overflow: visible;
}
.compact-icon-picker .icon-picker-panel,
.nav-structure-card .icon-picker-panel {
  width: min(620px, calc(100vw - 340px));
  max-width: 620px;
  max-height: 520px;
  grid-template-columns: repeat(5, minmax(84px, 1fr));
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-structure-card .level-three-line .icon-picker-panel {
  top: calc(100% + 6px);
}
.compact-icon-picker .icon-option span,
.nav-structure-card .icon-option span {
  min-height: 66px;
  padding: 9px 7px;
}
.compact-icon-picker .icon-option svg,
.nav-structure-card .icon-option svg {
  width: 18px;
  height: 18px;
}
.compact-icon-picker .icon-picker summary svg,
.nav-structure-card .icon-picker summary svg {
  width: 17px;
  height: 17px;
}
@media (max-width: 1180px) {
  .compact-icon-picker .icon-picker-panel,
  .nav-structure-card .icon-picker-panel {
    width: min(520px, calc(100vw - 48px));
    grid-template-columns: repeat(4, minmax(76px, 1fr));
  }
}
@media (max-width: 720px) {
  .compact-icon-picker .icon-picker-panel,
  .nav-structure-card .icon-picker-panel {
    width: min(360px, calc(100vw - 32px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Final navigation configuration layout fix */
.nav-global-add-panel {
  overflow: visible;
}
.nav-global-add-grid {
  grid-template-columns: 1fr !important;
  gap: 16px;
}
.nav-global-add-grid .inline-form {
  overflow: visible;
  align-items: end;
  padding: 42px 14px 14px;
}
.nav-global-add-grid .add-secondary-form {
  grid-template-columns: minmax(180px, 1fr) 58px minmax(220px, 1.2fr) auto !important;
}
.nav-global-add-grid .add-tertiary-form {
  grid-template-columns: minmax(170px, 0.9fr) minmax(220px, 1.2fr) 58px minmax(220px, 1.2fr) auto !important;
}
.nav-global-add-grid .add-tertiary-form .module-select-field,
.nav-global-add-grid .add-tertiary-form .parent-select-field,
.nav-global-add-grid .add-tertiary-form .icon-picker-field,
.nav-global-add-grid .add-tertiary-form .nav-new-name,
.nav-global-add-grid .add-tertiary-form button[type="submit"] {
  grid-column: auto !important;
}
.nav-global-add-grid button[type="submit"] {
  width: auto;
  min-width: 96px;
  padding: 0 16px;
  white-space: nowrap;
}
.nav-global-add-grid .icon-picker summary {
  width: 52px;
  min-width: 52px;
}
@media (max-width: 1180px) {
  .nav-global-add-grid .add-secondary-form,
  .nav-global-add-grid .add-tertiary-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .nav-global-add-grid .icon-picker-field,
  .nav-global-add-grid button[type="submit"] {
    grid-column: auto !important;
  }
  .nav-global-add-grid button[type="submit"] { width: 100%; }
}
@media (max-width: 720px) {
  .nav-global-add-grid .add-secondary-form,
  .nav-global-add-grid .add-tertiary-form {
    grid-template-columns: 1fr !important;
  }
}

/* Final icon picker popup fix: always open in viewport */
.icon-picker[open] .icon-picker-panel,
.compact-icon-picker .icon-picker[open] .icon-picker-panel,
.nav-structure-card .icon-picker[open] .icon-picker-panel,
.nav-global-add-grid .icon-picker[open] .icon-picker-panel {
  position: fixed !important;
  z-index: 5000 !important;
  top: 88px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: min(760px, calc(100vw - 40px)) !important;
  max-width: 760px !important;
  max-height: min(640px, calc(100vh - 124px)) !important;
  display: grid !important;
  grid-template-columns: repeat(6, minmax(88px, 1fr)) !important;
  gap: 10px !important;
  padding: 14px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border-radius: 12px !important;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28) !important;
}
.icon-picker[open] summary {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.icon-picker[open] .icon-option span {
  min-height: 70px;
}
@media (max-width: 860px) {
  .icon-picker[open] .icon-picker-panel,
  .compact-icon-picker .icon-picker[open] .icon-picker-panel,
  .nav-structure-card .icon-picker[open] .icon-picker-panel,
  .nav-global-add-grid .icon-picker[open] .icon-picker-panel {
    top: 64px !important;
    width: min(520px, calc(100vw - 24px)) !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 520px) {
  .icon-picker[open] .icon-picker-panel,
  .compact-icon-picker .icon-picker[open] .icon-picker-panel,
  .nav-structure-card .icon-picker[open] .icon-picker-panel,
  .nav-global-add-grid .icon-picker[open] .icon-picker-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Empty category add action */
.empty-state-action {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px;
}
.empty-state-action .button-link {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

/* Clickable second-level navigation with separate expand affordance */
.nested-summary {
  gap: 6px;
  padding-right: 8px;
}
.nested-summary::after { display: none; }
.nested-summary-link {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}
.nested-summary-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nested-toggle {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 6px;
  position: relative;
}
.nested-toggle::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.82;
}
.nav-collapse.nested[open] .nested-toggle::after {
  top: 6px;
  transform: rotate(225deg);
}

/* Navigation local feedback and drag ordering */
.nav-inline-feedback {
  margin-top: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}
.nav-inline-feedback.ok {
  background: transparent;
  color: #027a48;
}
.nav-inline-feedback.error {
  background: transparent;
  color: #be123c;
}
.nav-tree-children {
  display: grid;
  gap: 8px;
}
.nav-tree-line.editable-nav-line::before {
  content: none !important;
  display: none !important;
}
.nav-drag-handle {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 24px;
  justify-self: center;
  align-self: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  cursor: grab;
}
.nav-drag-handle::before {
  content: none !important;
  display: none !important;
}
.nav-drag-handle:active {
  cursor: grabbing;
}
.level-two-line .nav-drag-handle {
  background: #dbeafe;
  color: #1d4ed8;
}
.level-three-line .nav-drag-handle {
  background: #f2f4f7;
  color: #475467;
}
[data-drag-item].dragging {
  opacity: 0.58;
}

/* Global visual refresh */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #d7dde6;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-soft: #eef4ff;
  --accent: #0f766e;
  --accent-soft: #ecfdf3;
  --sidebar: #101828;
  --sidebar-soft: #1d2939;
  --sidebar-text: #eef2f6;
  --danger-bg: #fff1f2;
  --danger-text: #be123c;
  --warn-bg: #fffbeb;
}

body {
  background: #f6f7f9;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: #175cd3;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1, h2, h3,
.topbar-title strong,
.brand strong,
.panel-head h2,
.module-card-head h2,
.item-card-title {
  color: #111827;
  font-weight: 800;
  letter-spacing: 0;
}

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

h2 {
  font-size: 18px;
  line-height: 1.28;
}

.muted,
.module-card-head p,
.page-title p,
.section-title-row p {
  color: #667085;
}

.sidebar {
  background: #101828;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.brand {
  border-bottom-color: rgba(234, 236, 240, 0.12);
}

.brand span {
  color: #98a2b3;
}

.nav-link,
.nav-summary,
.sub-link,
.third-link {
  color: #d0d5dd;
  border-radius: 8px;
}

.nav-link:hover,
.nav-summary:hover,
.sub-link:hover,
.third-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.nav-link.active,
.nav-summary.active,
.sub-link.active,
.third-link.active {
  background: #ffffff;
  color: #101828;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.16);
}

.nav-icon {
  opacity: 0.92;
}

.topbar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: #e5e7eb;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.topbar-user-trigger {
  border-color: #e5e7eb;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.topbar-user-dropdown,
.field-select-panel,
.icon-picker-panel {
  border-color: #d7dde6;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.14);
}

.container {
  color: var(--text);
}

.panel,
.stat-card,
.item-card,
.search-total-card,
.search-mini-card,
.search-stat-panel,
.member-avatar-panel,
.member-form-main .form-section,
.auth-panel,
.login-card,
.nav-tree-root,
.nav-global-add-panel {
  background: #ffffff;
  border-color: #e1e6ef;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 26px rgba(16, 24, 40, 0.04);
}

.panel-head,
.subtle-panel-head,
.module-card-head {
  border-bottom-color: #eef2f6;
}

.stat-card {
  border-top: 3px solid #2563eb;
}

.dashboard-kpi-grid .stat-card:nth-child(2),
.search-mini-card:nth-child(3) {
  border-top-color: #0f766e;
}

.dashboard-kpi-grid .stat-card:nth-child(3),
.search-mini-card:nth-child(4) {
  border-top-color: #b45309;
}

.dashboard-kpi-grid .stat-card:nth-child(4) {
  border-top-color: #7c3aed;
}

.stat-card span,
.search-total-card span,
.search-mini-card span {
  color: #667085;
}

.stat-card strong,
.search-total-card strong,
.search-mini-card strong,
.amount-card strong {
  color: #101828;
  letter-spacing: 0;
}

label {
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  color: #182230;
  background: #ffffff;
  border-color: #cfd6e2;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(16, 24, 40, 0.02);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb9c8;
}

input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

button,
.button-link,
.link-button,
.soft-save,
.action-modal-primary,
.member-modal-primary {
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button,
.button-link,
.action-modal-primary,
.member-modal-primary {
  background: #2563eb;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

button:hover,
.button-link:hover,
.action-modal-primary:hover,
.member-modal-primary:hover {
  background: #1e40af;
  text-decoration: none;
}

button:focus-visible,
.button-link:focus-visible,
.link-button:focus-visible,
.soft-save:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

button.secondary,
.button-link.secondary {
  background: #ffffff;
  color: #344054;
  border-color: #cfd6e2;
}

button.secondary:hover,
.button-link.secondary:hover {
  background: #f8fafc;
  color: #182230;
}

.link-button {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.link-button:hover {
  background: #ffe4e6;
  color: #9f1239;
}

.soft-save {
  background: #eef4ff;
  color: #175cd3;
  border: 1px solid #b2ccff;
  box-shadow: none;
}

.soft-save:hover {
  background: #dbeafe;
  color: #1d4ed8;
}

.soft-save.saved {
  background: #ecfdf3;
  color: #027a48;
  border-color: #abefc6;
}

.data-table {
  border-color: #e5e7eb;
}

.data-table th {
  background: #f8fafc;
  color: #475467;
  border-bottom-color: #e5e7eb;
  font-weight: 800;
}

.data-table td {
  border-bottom-color: #eef2f6;
}

.data-table tr:hover td {
  background: #fbfcfe;
}

.status-pill,
.item-status-badge,
.module-key-badge,
.tag-badge,
.owner-badge {
  border-radius: 999px;
  font-weight: 800;
}

.status-pill,
.item-status-badge.status-active {
  background: #ecfdf3;
  color: #027a48;
}

.module-key-badge {
  background: #f8fafc;
  color: #475467;
  border: 1px solid #e5e7eb;
}

.empty-state,
.empty-state-action {
  background: #fbfcfe;
  border-color: #d7dde6;
  color: #667085;
}

.toast,
.alert,
.nav-inline-feedback {
  border-radius: 8px;
}

.success-toast {
  background: #ecfdf3;
  color: #027a48;
  border-color: #abefc6;
}

.error-toast,
.alert {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.action-modal-backdrop,
.member-modal-backdrop {
  background: rgba(16, 24, 40, 0.46);
}

.action-modal-card,
.member-modal-card {
  border-color: #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
}

.icon-option span {
  border-color: #e5e7eb;
  background: #ffffff;
}

.icon-option span:hover {
  background: #f8fafc;
  border-color: #b2ccff;
}

.icon-option input:checked + span {
  background: #eef4ff;
  color: #175cd3;
  border-color: #84adff;
}

.nav-tree-root,
.nav-tree-line.editable-nav-line {
  background: #ffffff;
}

.level-two-line .nav-drag-handle {
  background: #eef4ff;
  color: #175cd3;
}

.level-three-line .nav-drag-handle {
  background: #f2f4f7;
  color: #475467;
}

@media (max-width: 860px) {
  .sidebar {
    box-shadow: none;
  }
}

/* Sidebar second-level nav consistency */
.sub-nav .sub-link,
.sub-nav .nested-summary {
  background: transparent !important;
  color: #c6d0de;
  border: 1px solid transparent;
  box-shadow: none !important;
}

.sub-nav .sub-link:hover,
.sub-nav .nested-summary:hover {
  background: rgba(255, 255, 255, 0.075) !important;
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: none !important;
}

.sub-nav .sub-link.active,
.sub-nav .nested-summary.active {
  background: rgba(255, 255, 255, 0.13) !important;
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: none !important;
}

.sub-nav .nested-summary.active .nested-summary-link,
.sub-nav .nested-summary:hover .nested-summary-link {
  color: inherit !important;
}

.third-nav .third-link {
  background: transparent !important;
  color: #9facbd;
  border: 1px solid transparent;
  box-shadow: none !important;
}

.third-nav .third-link:hover {
  background: rgba(255, 255, 255, 0.055) !important;
  color: #f8fafc !important;
}

.third-nav .third-link.active {
  background: rgba(255, 255, 255, 0.09) !important;
  color: #ffffff !important;
}

.sidebar .brand strong {
  color: #ffffff !important;
}

.sidebar .brand span {
  color: #cbd5e1 !important;
}

/* Final sidebar visual system */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 34%),
    #172033 !important;
  color: #e8eef7;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 10px 0 28px rgba(16, 24, 40, 0.10);
}

.sidebar .brand {
  border-bottom-color: rgba(232, 238, 247, 0.12) !important;
}

.sidebar .brand strong {
  color: #f8fafc !important;
  font-weight: 850;
}

.sidebar .brand span {
  color: #aebbd0 !important;
}

.side-nav {
  gap: 7px;
}

.nav-link,
.nav-summary,
.sub-link,
.third-link {
  border: 1px solid transparent;
  box-shadow: none;
}

.nav-link,
.nav-summary {
  color: #d7e0ee !important;
  background: transparent !important;
}

.nav-link:hover,
.nav-summary:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none !important;
}

.nav-link.active,
.nav-summary.active {
  background: #eef4ff !important;
  color: #172033 !important;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(9, 17, 32, 0.20) !important;
}

.sub-nav {
  border-left-color: rgba(174, 187, 208, 0.20) !important;
}

.sub-nav .sub-link,
.sub-nav .nested-summary {
  background: transparent !important;
  color: #bfccdd !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.sub-nav .sub-link:hover,
.sub-nav .nested-summary:hover {
  background: rgba(238, 244, 255, 0.075) !important;
  color: #ffffff !important;
  border-color: rgba(238, 244, 255, 0.08) !important;
}

.sub-nav .sub-link.active,
.sub-nav .nested-summary.active {
  background: rgba(238, 244, 255, 0.14) !important;
  color: #ffffff !important;
  border-color: rgba(238, 244, 255, 0.12) !important;
  box-shadow: inset 2px 0 0 rgba(238, 244, 255, 0.72) !important;
}

.sub-nav .nested-summary.active .nested-summary-link,
.sub-nav .nested-summary:hover .nested-summary-link {
  color: inherit !important;
}

.third-nav {
  border-left-color: rgba(174, 187, 208, 0.14) !important;
}

.third-nav .third-link {
  background: transparent !important;
  color: #9eacbf !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.third-nav .third-link:hover {
  background: rgba(238, 244, 255, 0.055) !important;
  color: #eef4ff !important;
}

.third-nav .third-link.active {
  background: rgba(238, 244, 255, 0.095) !important;
  color: #ffffff !important;
  box-shadow: inset 2px 0 0 rgba(238, 244, 255, 0.42) !important;
}

.nested-toggle {
  color: currentColor;
  opacity: 0.72;
}

.nav-collapse[open] > .nav-summary:not(.active) {
  background: rgba(238, 244, 255, 0.055) !important;
  color: #f8fafc !important;
}

/* Sidebar redesign: layered pills, no vertical active lines */
.sidebar {
  background:
    radial-gradient(circle at 30% 0%, rgba(96, 165, 250, 0.12), transparent 32%),
    linear-gradient(180deg, #1b2638 0%, #111827 100%) !important;
}

.side-nav {
  gap: 8px;
}

.nav-collapse {
  border-radius: 10px;
}

.nav-link,
.nav-summary {
  border: 0 !important;
  border-radius: 10px !important;
  color: #d8e1ee !important;
}

.nav-link:hover,
.nav-summary:hover,
.nav-collapse[open] > .nav-summary:not(.active) {
  background: rgba(255, 255, 255, 0.075) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.nav-link.active,
.nav-summary.active {
  background: #f8fafc !important;
  color: #172033 !important;
  box-shadow: 0 10px 22px rgba(7, 13, 24, 0.20) !important;
}

.sub-nav {
  gap: 5px !important;
  margin: 7px 0 9px 8px !important;
  padding: 8px 0 8px 8px !important;
  border-left: 0 !important;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.sub-nav .sub-link,
.sub-nav .nested-summary {
  min-height: 36px;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: #d4deea !important;
  font-size: 14px;
  font-weight: 800;
  box-shadow: none !important;
}

.sub-nav .sub-link:hover,
.sub-nav .nested-summary:hover {
  background: rgba(255, 255, 255, 0.075) !important;
  color: #ffffff !important;
}

.sub-nav .sub-link.active,
.sub-nav .nested-summary.active {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.third-nav {
  gap: 4px !important;
  margin: 3px 0 9px 22px !important;
  padding: 2px 0 0 0 !important;
  border-left: 0 !important;
}

.third-nav .third-link {
  min-height: 26px;
  padding: 0 9px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: #93a3b8 !important;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none !important;
}

.third-nav .third-link:hover {
  background: rgba(255, 255, 255, 0.055) !important;
  color: #eef4ff !important;
}

.third-nav .third-link.active {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

/* Sidebar polish: clearer hierarchy with quiet selected pills */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 210px),
    #151f2e !important;
}

.side-nav {
  gap: 6px;
}

.nav-link,
.nav-summary {
  min-height: 40px;
  padding: 0 11px !important;
  border-radius: 9px !important;
  color: #d7dfeb !important;
  font-size: 14px;
  font-weight: 800;
}

.nav-link.active,
.nav-summary.active {
  background: #edf3fb !important;
  color: #142033 !important;
  box-shadow: 0 8px 18px rgba(4, 10, 20, 0.18) !important;
}

.nav-link:hover,
.nav-summary:hover,
.nav-collapse[open] > .nav-summary:not(.active) {
  background: rgba(237, 243, 251, 0.075) !important;
  color: #ffffff !important;
}

.sub-nav {
  margin: 7px 0 10px 6px !important;
  padding: 7px 0 7px 9px !important;
  gap: 4px !important;
  background: rgba(5, 13, 28, 0.16) !important;
  border: 1px solid rgba(237, 243, 251, 0.055) !important;
  border-radius: 11px !important;
}

.sub-nav .sub-link,
.sub-nav .nested-summary {
  min-height: 34px;
  padding: 0 10px !important;
  border-radius: 8px !important;
  color: #c6d2e2 !important;
  font-size: 13px;
  font-weight: 780;
}

.sub-nav .sub-link:hover,
.sub-nav .nested-summary:hover {
  background: rgba(237, 243, 251, 0.075) !important;
  color: #ffffff !important;
}

.sub-nav .sub-link.active,
.sub-nav .nested-summary.active {
  background: rgba(237, 243, 251, 0.20) !important;
  color: #ffffff !important;
}

.third-nav {
  margin: 4px 0 8px 18px !important;
  padding: 1px 0 0 0 !important;
  gap: 3px !important;
}

.third-nav .third-link {
  min-height: 25px;
  padding: 0 9px !important;
  border-radius: 7px !important;
  color: #98a8bb !important;
  font-size: 12px;
  font-weight: 700;
}

.third-nav .third-link:hover {
  background: rgba(237, 243, 251, 0.055) !important;
  color: #dbe7f6 !important;
}

.third-nav .third-link.active {
  background: rgba(237, 243, 251, 0.13) !important;
  color: #ffffff !important;
}

.sub-icon {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
  opacity: 0.9;
}

.third-icon {
  width: 13px;
  height: 13px;
  flex-basis: 13px;
  opacity: 0.72;
}

/* Module delete buttons */
.nav-admin-row > form:not(.module-edit-form) button.secondary {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}

.nav-admin-row > form:not(.module-edit-form) button.secondary:hover {
  background: #ffe4e6;
  color: #9f1239;
  border-color: #fda4af;
}

/* Search result hierarchy chips */
.search-level-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.search-level-chip {
  min-height: 24px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.search-level-chip.level-one {
  background: #eef4ff;
  border-color: #c7d7fe;
  color: #1d4ed8;
}

.search-level-chip.level-two {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.search-level-chip.level-three {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.search-category-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Search overview level cards: keep hierarchy color after global card polish */
.search-overview-redesign .search-total-card {
  min-height: 138px;
  padding: 20px 22px;
  border: 1px solid rgba(191, 219, 254, 0.7);
  border-radius: 8px;
  background: linear-gradient(135deg, #123a6f 0%, #1d4ed8 55%, #0f766e 100%);
  color: #ffffff;
  box-shadow: 0 14px 36px rgba(29, 78, 216, 0.16);
}

.search-overview-redesign .search-total-card::after {
  display: none;
}

.search-overview-redesign .search-total-card span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  opacity: 1;
}

.search-overview-redesign .search-total-card strong {
  margin: 12px 0 8px;
  color: #ffffff;
  font-size: 46px;
  letter-spacing: 0;
}

.search-overview-redesign .search-total-card p {
  color: rgba(255, 255, 255, 0.82);
  opacity: 1;
}

.search-overview-redesign .search-level-card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  padding: 18px;
  border-width: 1px;
  border-style: solid;
  border-radius: 8px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.07);
}

.search-overview-redesign .search-level-card::after {
  display: none;
}

.search-overview-redesign .search-level-card::before {
  content: "1";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
}

.search-overview-redesign .search-level-card.level-one {
  background: linear-gradient(135deg, #eef4ff 0%, #ffffff 70%);
  border-color: #c7d7fe;
}

.search-overview-redesign .search-level-card.level-one::before {
  background: #dbeafe;
  color: #1d4ed8;
}

.search-overview-redesign .search-level-card.level-one span,
.search-overview-redesign .search-level-card.level-one strong {
  color: #1d4ed8;
}

.search-overview-redesign .search-level-card.level-two {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 70%);
  border-color: #bbf7d0;
}

.search-overview-redesign .search-level-card.level-two::before {
  content: "2";
  background: #dcfce7;
  color: #047857;
}

.search-overview-redesign .search-level-card.level-two span,
.search-overview-redesign .search-level-card.level-two strong {
  color: #047857;
}

.search-overview-redesign .search-level-card.level-three {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 70%);
  border-color: #fed7aa;
}

.search-overview-redesign .search-level-card.level-three::before {
  content: "3";
  background: #ffedd5;
  color: #c2410c;
}

.search-overview-redesign .search-level-card.level-three span,
.search-overview-redesign .search-level-card.level-three strong {
  color: #c2410c;
}

.search-overview-redesign .search-level-card span {
  max-width: calc(100% - 44px);
  color: #475467;
  font-size: 13px;
  opacity: 1;
}

.search-overview-redesign .search-level-card strong {
  font-size: 34px;
  line-height: 1;
}
