/* Professional UI Styles for System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('/static/styles/design-tokens.css');
@import url('/static/css/typography.css?v=20260602-chinese-yahei-v2');
@import url('/static/css/table.css?v=20260602-preserve-numeric-font-v2');
@import url('/static/css/filter-bar.css?v=20260519-v1');
@import url('/static/css/form.css?v=20260519-v1');
@import url('/static/css/button.css?v=20260519-v1');
@import url('/static/css/badge.css?v=20260519-v1');
@import url('/static/css/pagination.css?v=20260525-runtime-pagination-v1');
@import url('/static/css/admin/workspace-shell.css?v=20260525-runtime-admin-workspace-v1');
@import url('/static/css/admin/workspace-shell-system.css?v=20260525-runtime-admin-workspace-system-v1');
@import url('/static/css/admin/workspace-shell-mobile.css?v=20260525-runtime-admin-workspace-mobile-v1');
@import url('/static/css/admin/workspace-settings-panes.css?v=20260602-runtime-admin-settings-panes-v1');
@import url('/static/css/admin/workspace-plugin-center.css?v=20260602-runtime-admin-plugin-center-v1');
@import url('/static/css/executive/runtime-intelligence.css?v=20260602-executive-runtime-intelligence-v1');
@import url('/static/css/learning/review.css?v=20260602-learning-review-v1');
@import url('/static/css/learning/course_vocabulary.css?v=20260617-course-detail-tabs-v2');
@import url('/static/css/docs/runtime_docs.css?v=20260602-runtime-docs-v1');

:root {
  --primary-color: var(--ds-primary);
  --primary-hover: var(--ds-primary-hover);
  --brand-orange: var(--ds-primary);
  --brand-orange-soft: var(--ds-primary-soft);
  --brand-yellow: var(--ds-warning);
  --enterprise-navy: var(--ds-sidebar);
  --enterprise-slate: var(--ds-text);
  --enterprise-panel: var(--ds-sidebar-hover);
  --secondary-color: var(--color-text-secondary);
  --secondary-hover: color-mix(in srgb, var(--color-text-secondary) 85%, var(--color-text-primary));
  --success-color: var(--ds-success);
  --warning-color: var(--ds-warning);
  --warning-hover: color-mix(in srgb, var(--warning-color) 88%, var(--ds-warning-text));
  --error-color: var(--ds-danger);
  --error-hover: color-mix(in srgb, var(--error-color) 88%, var(--ds-danger-text));
  --processing-color: var(--ds-info);
  --background-color: var(--ds-background);
  --surface-color: var(--ds-card);
  --soft-surface: var(--ds-card-muted);
  --text-color: var(--ds-text);
  --muted-text: var(--ds-text-muted);
  --text-primary: var(--ds-text);
  --text-secondary: var(--ds-text-muted);
  --border-color: var(--ds-border);
  --shadow: var(--ds-shadow-sm);
  --shadow-lg: var(--ds-shadow);
  --border-radius: var(--ds-radius);
  --border-radius-lg: var(--ds-radius-lg);
  --space-page: var(--ds-space-6);
  --space-module: var(--ds-space-6);
  --space-field: var(--ds-space-4);
  --space-button: var(--ds-space-2);
  --control-height: 42px;
  --button-height: 40px;
  --button-min-width: 88px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg-page);
  color: var(--theme-color-text);
  line-height: 1.6;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--theme-color-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--theme-shadow-level-3);
  overflow: hidden;
}

/* Header */
.brand-bar {
  background: var(--surface-color);
  padding: 1.25rem 2rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--soft-surface);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.brand-bar .logo + .home-link {
  margin-left: auto;
}

.home-link:hover {
  background: var(--surface-color);
  box-shadow: var(--shadow);
}

.ui-language-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  white-space: nowrap;
}

.lang-switch-trigger,
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.lang-switch-trigger {
  min-width: 158px;
  padding: 0.52rem 0.7rem;
  border-color: var(--border-color);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.lang-switch-trigger:hover,
.ui-language-switch.open .lang-switch-trigger {
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.lang-switch-caret {
  font-size: 0.68rem;
  opacity: 0.68;
  transition: transform 0.18s ease;
}

.ui-language-switch.open .lang-switch-caret {
  transform: rotate(180deg);
}

.lang-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: none;
  min-width: 184px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.ui-language-switch.open .lang-switch-menu {
  display: grid;
  gap: 4px;
}

.lang-switch-btn {
  width: 100%;
  min-width: 0;
  padding: 0.62rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.lang-switch-btn.active {
  background: #eef2ff;
  color: var(--text-primary);
  box-shadow: none;
}

.lang-switch-btn:hover {
  background: var(--surface-color);
  color: var(--text-primary);
}

.lang-switch-check {
  margin-left: auto;
  color: var(--primary-color);
  font-size: 0.8rem;
  opacity: 0;
}

.lang-switch-btn.active .lang-switch-check {
  opacity: 1;
}

.locale-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #ffffff;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
}

.lang-flag {
  display: none;
}

.lang-code {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  width: clamp(160px, 22vw, 240px);
  height: auto;
  max-height: 80px;
  object-fit: contain;
  flex: 0 0 auto;
}

.title h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.title p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 400px;
}

/* Home */
.home-shell {
  min-height: calc(100vh - 4rem);
}

.home-header {
  color: white;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

.home-kicker {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 0.9;
  margin-bottom: 0.35rem;
}

.home-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.home-header p:last-child {
  max-width: 680px;
  font-size: 1.08rem;
  opacity: 0.92;
}

.home-main {
  padding: 2rem;
}

.module-section {
  display: grid;
  gap: 1.25rem;
}

.section-heading h2 {
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.section-heading p {
  color: var(--text-secondary);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.module-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  min-height: 170px;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.module-card.active {
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.module-card.active:hover {
  transform: translateY(-2px);
  border-color: rgba(231, 101, 39, 0.42);
  box-shadow: var(--shadow-lg);
}

.module-card.disabled {
  background: #f8fafc;
  color: var(--text-secondary);
}

.module-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  background: #fef3c7;
  color: var(--primary-hover);
  font-size: 1.25rem;
}

.module-content {
  min-width: 0;
}

.module-content h3 {
  font-size: 1.12rem;
  margin-bottom: 0.35rem;
}

.module-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.module-action,
.module-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-hover);
}

.module-status {
  color: var(--text-secondary);
}

.os-console-body {
  background: #e8edf4;
}

.os-console-shell {
  max-width: 1280px;
  background: #f4f7fb;
  color: #1f2937;
  box-shadow: 0 26px 70px rgb(15 23 42 / 0.16);
}

.os-brand-bar {
  background: #0b1220;
  border-bottom: 1px solid rgb(148 163 184 / 0.18);
}

.os-brand-bar .logo + .os-top-status {
  margin-left: auto;
}

.os-brand-bar > .logo {
  width: auto;
  height: 40px;
  max-height: 40px;
}

.os-brand-bar .home-link,
.os-brand-bar .ui-language-switch {
  border-color: rgb(148 163 184 / 0.22);
  background: rgb(17 24 39 / 0.72);
  color: #e5edf8;
}

.os-brand-bar .home-link:hover {
  background: rgb(30 41 59 / 0.9);
}

.os-brand-bar .lang-switch-btn {
  color: #cbd5e1;
}

.os-brand-bar .lang-switch-btn.active {
  background: var(--brand-orange);
  color: #fff7ed;
}

.os-brand-title {
  display: grid;
  gap: 0.12rem;
  margin-right: auto;
  color: #e5edf8;
}

.os-brand-title strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.os-brand-title span {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.os-top-status,
.os-current-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgb(148 163 184 / 0.22);
  border-radius: var(--border-radius);
  background: rgb(17 24 39 / 0.72);
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 700;
}

.os-online-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--brand-yellow);
  box-shadow: 0 0 0 4px rgb(253 209 0 / 0.14);
}

.os-console-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 1.5rem;
  align-items: end;
  background:
    linear-gradient(135deg, rgb(11 18 32 / 0.99), rgb(31 41 55 / 0.96)),
    radial-gradient(circle at 88% 8%, rgb(231 101 39 / 0.12), transparent 34%);
  padding: 2.35rem 2rem 2rem;
}

.os-console-hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.7rem);
}

.os-hero-logo {
  display: block;
  width: min(360px, 72vw);
  max-height: 112px;
  object-fit: contain;
  object-position: left center;
}

.os-console-hero p:last-child {
  color: #cbd5e1;
  font-weight: 700;
}

.os-hero-copy > p:not(.home-kicker) {
  max-width: 760px;
  color: #cbd5e1;
  font-size: 1.02rem;
}

.os-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.15rem;
}

.os-hero-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgb(148 163 184 / 0.22);
  border-radius: 999px;
  background: rgb(15 23 42 / 0.42);
  color: #dbeafe;
  font-size: 0.8rem;
  font-weight: 700;
}

.os-command-panel {
  display: grid;
  gap: 0.72rem;
  padding: 1rem;
  border: 1px solid rgb(148 163 184 / 0.22);
  border-radius: var(--border-radius);
  background: rgb(11 18 32 / 0.64);
  color: #dbeafe;
  font-size: 0.88rem;
  font-weight: 700;
}

.os-command-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.68rem;
  border-bottom: 1px solid rgb(148 163 184 / 0.14);
}

.os-command-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.os-command-row span {
  color: #94a3b8;
}

.os-command-row strong {
  color: #f8fafc;
  text-align: right;
}

.status-online {
  color: var(--brand-yellow);
}

.os-console-main {
  display: grid;
  gap: 1.15rem;
  padding: 1.25rem;
  background: #f4f7fb;
}

.os-console-section {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
  border: 1px solid #dde5ee;
  border-radius: var(--border-radius);
  background: #ffffff;
}

.os-console-section-feature {
  border-left: 4px solid var(--brand-orange);
}

.os-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.os-section-heading h2 {
  color: #172033;
  font-size: 1.05rem;
  margin: 0;
}

.os-section-heading p {
  max-width: 720px;
  color: #64748b;
  font-size: 0.9rem;
  text-align: right;
}

.os-section-kicker {
  display: block;
  margin-bottom: 0.1rem;
  color: var(--brand-orange);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.os-console-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0.85rem;
}

.os-console-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

.os-module-card {
  min-height: 168px;
  border-color: #dde5ee;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #172033;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.os-module-card-large {
  min-height: 150px;
}

.os-module-card .module-icon {
  background: rgb(231 101 39 / 0.13);
  color: var(--brand-orange);
}

.os-module-card .module-action {
  color: var(--brand-orange-soft);
}

.os-module-card .module-content p {
  color: #64748b;
}

.os-module-card.disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.os-module-card.disabled .module-icon {
  background: rgb(148 163 184 / 0.12);
  color: #94a3b8;
}

.os-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.os-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.os-status-badge.active {
  border-color: rgb(5 150 105 / 0.18);
  background: #ecfdf5;
  color: #047857;
}

.os-status-badge.planned {
  border-color: rgb(100 116 139 / 0.18);
  background: #eef2f7;
  color: #64748b;
}

.retail-ownership-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  align-items: center;
  border-left: 4px solid var(--primary-color);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.retail-ownership-hero h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.35rem;
}

.retail-path-label {
  color: var(--primary-hover);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.retail-ownership-meta {
  display: grid;
  gap: 0.45rem;
}

.retail-ownership-meta span {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.retail-architecture-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.retail-panel {
  display: grid;
  gap: 1rem;
}

.retail-segment-list {
  display: grid;
  gap: 0.75rem;
}

.retail-segment-card,
.retail-project-card,
.retail-platform-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #ffffff;
}

.retail-segment-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
}

.retail-segment-card.active {
  border-color: rgb(231 101 39 / 0.36);
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.retail-segment-card h3,
.retail-project-card h3,
.retail-platform-card h3 {
  margin: 0;
  font-size: 1rem;
}

.retail-segment-card p,
.retail-project-card p,
.retail-platform-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.retail-project-card,
.retail-import-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.retail-project-card {
  padding: 1rem;
}

.retail-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.retail-platform-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 1rem;
}

.retail-platform-card > i {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  background: #eef2f7;
  color: var(--secondary-color);
}

.retail-platform-card.active > i {
  background: rgb(231 101 39 / 0.12);
  color: var(--primary-color);
}

.retail-import-placeholder {
  border-style: dashed;
  background: #f8fafc;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.status-pass {
  background: #ecfdf5;
  color: #047857;
}

.status-pending {
  background: #eef2f7;
  color: #64748b;
}

.business-config-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1rem;
  align-items: center;
  border-left: 4px solid var(--primary-color);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.business-config-hero h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.35rem;
}

.business-config-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.business-config-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.business-config-form {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}

.business-config-form.store-form {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.business-config-list {
  display: grid;
  gap: 0.6rem;
}

.business-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #ffffff;
}

.business-config-row div {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.business-config-row strong {
  color: var(--text-primary);
}

.business-config-row span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.business-config-row em {
  min-width: 64px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.import-pipeline-panel {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.import-pipeline-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1.4fr) auto;
  align-items: end;
}

.import-pipeline-form.mapping-form {
  grid-template-columns: minmax(170px, 0.9fr) minmax(190px, 1fr) minmax(160px, 0.8fr) minmax(210px, 1.1fr) minmax(120px, 0.55fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(160px, 0.8fr) auto auto;
}

.import-pipeline-form.standard-field-form {
  grid-template-columns: minmax(140px, 0.8fr) minmax(170px, 1fr) minmax(170px, 1fr) minmax(130px, 0.75fr) minmax(220px, 1.2fr) auto;
}

.import-pipeline-form.merged-order-filter-form {
  grid-template-columns: minmax(120px, 0.6fr) minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(190px, 1fr) auto;
}

.import-validation-preview {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-left: 4px solid #94a3b8;
  border-radius: var(--border-radius);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.import-validation-preview strong {
  color: var(--text-primary);
}

.import-validation-preview.valid {
  border-left-color: var(--success-color);
  background: #f0fdf4;
}

.import-validation-preview.invalid {
  border-left-color: var(--error-color);
  background: #fef2f2;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--control-height);
  color: var(--text-secondary);
  font-weight: 800;
}

.import-row-count {
  min-width: 60px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.import-validation-row.valid {
  border-left: 4px solid var(--success-color);
}

.import-validation-row.invalid {
  border-left: 4px solid var(--error-color);
}

.import-validation-row.valid em {
  background: #ecfdf5;
  color: #047857;
}

.import-validation-row.invalid em {
  background: #fef2f2;
  color: #b91c1c;
}

/* Course Manager */
.course-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: start;
}

.course-category-panel,
.course-category-form {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.course-category-form {
  display: grid;
  gap: 1rem;
}

.category-settings-panel {
  display: grid;
  gap: var(--space-field);
}

.category-settings-toolbar {
  grid-template-columns: minmax(260px, 420px);
  margin-bottom: 0;
}

.category-settings-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: var(--space-field);
  align-items: start;
}

.category-settings-inline {
  display: grid;
  grid-template-columns: minmax(360px, 1.6fr) minmax(180px, 0.8fr) minmax(160px, 0.75fr) minmax(180px, 0.85fr) auto;
  gap: var(--space-field);
  align-items: end;
}

.category-settings-tree {
  min-height: 180px;
}

.category-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-button);
  margin-bottom: var(--space-field);
  padding: 0.75rem 0.9rem;
  border-radius: var(--border-radius);
  background: #fffbeb;
  color: var(--text-primary);
}

.category-tree-header strong {
  font-size: 15px;
}

.category-tree-header span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.category-tree ul {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.book-list ul {
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.category-tree li ul {
  margin-top: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
}

.category-node {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(180px, 1.2fr) minmax(180px, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
}

.category-node strong {
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-node > span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-node > em {
  min-width: 0;
  color: var(--primary-hover);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-node-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  white-space: nowrap;
}

.category-node-meta small {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.6rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
}

.book-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
}

.book-item span {
  font-weight: 700;
}

.book-item small {
  color: var(--text-secondary);
}

.empty-state {
  padding: 1rem;
  color: var(--text-secondary);
  background: #f8fafc;
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius);
}

.inline-message {
  font-size: 0.9rem;
  font-weight: 600;
}

.inline-message:empty {
  display: none;
}

.inline-message:not(:empty) {
  min-height: 1.25rem;
}

.inline-message.is-loading {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid #fde68a;
  border-radius: var(--border-radius);
  background: #fffbeb;
  color: var(--warning-hover);
}

.inline-message.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #fcd34d;
  border-top-color: var(--warning-hover);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.inline-message.success {
  color: var(--success-color);
}

.inline-message.error {
  color: var(--error-color);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

/* Form Sections */
.section {
  margin-bottom: 2rem;
}

.section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section h3::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 2px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-title-row h3 {
  margin-bottom: 0;
}

.settings-panel {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
}

.settings-subtitle {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.muted-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.settings-actions + .settings-subtitle {
  margin-top: 1.25rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.settings-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-entry-fields {
  margin-bottom: 0;
}

.settings-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.settings-table th,
.settings-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.settings-table th {
  background: #f1f5f9;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 800;
}

.settings-table tr:last-child td {
  border-bottom: 0;
}

.settings-table input,
.settings-table select {
  min-height: 34px;
  padding: 0.4rem 0.55rem;
}

.settings-table td:last-child,
.settings-table th:last-child {
  width: 170px;
}

.settings-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
}

.settings-row span {
  font-weight: 700;
}

.settings-row .form-group {
  min-width: 0;
}

.settings-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Text Input */
.text-input-container {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 300px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(231, 101, 39, 0.18);
}

.text-actions {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Grid Layout */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-full {
  grid-column: 1 / -1;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.signature-preview {
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--ds-border, #d8dee8);
  border-radius: 8px;
  color: #64748b;
  background: #fff;
  font-size: 12px;
}

.profile-signature-control {
  gap: 8px;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.signature-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.signature-file-name {
  min-width: 120px;
  max-width: 240px;
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signature-preview img {
  display: block;
  max-width: 180px;
  max-height: 56px;
  object-fit: contain;
}

.field-help {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

input, select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(231, 101, 39, 0.18);
}

.password-input-wrap {
  position: relative;
  width: 100%;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.folder-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: stretch;
}

.folder-picker .btn {
  white-space: nowrap;
}

.note {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--primary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--primary-color);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-warning {
  background: var(--warning-color);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Actions */
.actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

/* Progress and Stats */
.stats {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.progress-container {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Log */
.log-container {
  background: #0f172a;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  max-height: 400px;
  overflow-y: auto;
}

.log-content {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
}

/* Popups */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.popup {
  background: var(--surface-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.popup h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.popup-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Review List */
.review-summary {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: var(--border-radius);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}

.review-summary.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.review-summary.warning {
  background: #fffbeb;
  border-color: #fed7aa;
}

.review-list {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.review-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.review-item:last-child {
  border-bottom: none;
}

.review-item.changed {
  background: #fef3c7;
}

.review-original, .review-safe {
  display: flex;
  flex-direction: column;
}

.review-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.review-value {
  font-family: monospace;
  font-size: 0.875rem;
  word-break: break-all;
}

.badge {
  display: inline-block;
  background: var(--error-color);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

.count-badge {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.success {
  background: #dcfce7;
  color: #166534;
}

.status-pill.error {
  background: #fee2e2;
  color: #991b1b;
}

.audio-row-error {
  background: #fff7ed;
}

.audio-result-section {
  margin-top: var(--space-module);
}

.course-audio-player {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  width: min(360px, calc(100vw - 32px));
}

.learning-hidden-audio {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
  bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .brand-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-link {
    margin-left: 0;
    align-self: stretch;
    justify-content: center;
  }

  .ui-language-switch {
    align-self: stretch;
  }

  .lang-switch-btn {
    flex: 1;
  }

  .os-console-hero {
    grid-template-columns: 1fr;
    padding: 1.75rem 1.25rem;
  }

  .os-command-panel {
    width: 100%;
  }

  .os-console-main {
    padding: 0.85rem;
  }

  .os-section-heading {
    display: grid;
  }

  .os-section-heading p {
    text-align: left;
  }

  .os-card-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .header {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .title h1 {
    font-size: 2rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .folder-picker {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .review-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .home-header,
  .home-main {
    padding: 1.5rem;
  }

  .module-card {
    grid-template-columns: 1fr;
  }

  .course-manager {
    grid-template-columns: 1fr;
  }

  .category-settings-toolbar,
  .category-settings-layout,
  .category-settings-inline {
    grid-template-columns: 1fr;
  }

  .section-title-row,
  .settings-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .settings-entry-row {
    grid-template-columns: 1fr;
  }

  .settings-row-actions {
    justify-content: flex-start;
  }

  .category-node {
    grid-template-columns: 1fr;
  }

  .category-node strong,
  .category-node > span,
  .category-node > em {
    white-space: normal;
  }

  .category-node-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Button hover effects */
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Form focus states */
textarea:focus, input:focus, select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(231, 101, 39, 0.18);
}

/* Custom scrollbar */
.log-container::-webkit-scrollbar {
  width: 8px;
}

.log-container::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Popup animations */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  animation: fadeIn 0.3s ease-out;
}

.popup {
  width: min(640px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
}

.popup h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Success and warning text colors */
.success-text {
  color: var(--success-color);
  font-weight: 600;
}

.warn-text {
  color: var(--warning-color);
  font-weight: 600;
}

.import-panel {
  display: grid;
  gap: 1rem;
}

.audit-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-top: 1rem;
}

.audit-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: var(--surface-color);
}

.audit-table th,
.audit-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

.audit-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
}

.audit-table tr:last-child td {
  border-bottom: 0;
}

.error-cell {
  background: #fef2f2;
  color: #991b1b;
  font-weight: 700;
}

.invalid-char {
  padding: 0.05rem 0.18rem;
  border-radius: 4px;
  background: #dc2626;
  color: #ffffff;
}

.empty-cell {
  color: var(--text-secondary);
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
}

.modal-overlay.hidden {
  display: none;
}

.modal-panel {
  width: min(560px, 100%);
  padding: 1.25rem;
  border-radius: var(--border-radius);
  background: var(--surface-color);
  box-shadow: var(--shadow-lg);
}

#vocabEditModal .modal-panel {
  width: min(1280px, calc(100vw - 32px));
  max-height: 94vh;
  overflow: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.app-modal-message {
  color: var(--text-primary);
  white-space: pre-line;
  margin-bottom: 1rem;
}

.app-modal-tip {
  margin: -0.35rem 0 1rem;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.app-modal-panel.app-modal-panel-wide {
  width: min(1440px, calc(100vw - 32px));
  max-height: 92vh;
  overflow: auto;
}

.app-modal-message.app-modal-message-table {
  white-space: normal;
}

.tidy-preview-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.tidy-preview-summary span {
  color: var(--text-muted);
  font-size: 14px;
}

.tidy-preview-table-wrap {
  max-height: min(64vh, 680px);
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.tidy-preview-table {
  margin: 0;
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.tidy-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.tidy-preview-table th:nth-child(1),
.tidy-preview-table td:nth-child(1) {
  width: 64px;
}

.tidy-preview-table th:nth-child(2),
.tidy-preview-table td:nth-child(2) {
  width: 96px;
}

.tidy-preview-table th:nth-child(3),
.tidy-preview-table td:nth-child(3) {
  width: 88px;
}

.tidy-preview-table th:nth-child(4),
.tidy-preview-table td:nth-child(4) {
  width: 132px;
}

.tidy-preview-table th:nth-child(5),
.tidy-preview-table td:nth-child(5) {
  width: 20%;
}

.tidy-preview-table th:nth-child(6),
.tidy-preview-table td:nth-child(6) {
  width: 40%;
}

.tidy-preview-value {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.app-modal-actions {
  justify-content: flex-end;
  margin: 1rem 0 0;
}

.vocab-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.vocab-edit-field label,
.vocabulary-edit-panel label {
  font-size: 16px;
}

.vocab-edit-field textarea,
.vocab-edit-field input,
.vocabulary-edit-panel input,
.vocabulary-edit-panel textarea {
  min-height: 52px;
  font-size: 17px;
  line-height: 1.55;
}

.vocab-edit-field textarea {
  min-height: 108px;
  padding: 12px 14px;
  resize: vertical;
}

.vocab-edit-field.has-validation-error label {
  color: #dc2626;
}

.vocab-edit-field.has-validation-error textarea,
.vocab-edit-field.has-validation-error input {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.validation-edit-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 8px;
  background: rgba(254, 242, 242, 0.9);
  color: #991b1b;
  font-size: 16px;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  color: var(--text-primary);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-color);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .audit-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .vocab-edit-form {
    grid-template-columns: 1fr;
  }

  .vocabulary-edit-panel .form-grid {
    grid-template-columns: 1fr;
  }

  .vocabulary-edit-panel .wide-field {
    grid-column: auto;
  }
}

.system-info-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: var(--space-module);
  padding: 1.35rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: var(--shadow);
}

.system-info-hero h3 {
  margin: 0.2rem 0 0.45rem;
  font-size: 1.35rem;
}

.system-info-hero p:last-child {
  max-width: 760px;
  color: var(--text-secondary);
}

.system-info-stack {
  display: grid;
  gap: 0.55rem;
  min-width: 220px;
}

.system-info-stack span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.system-table-grid,
.system-function-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.system-table-grid > div,
.system-function-map > div {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
}

.system-table-grid strong,
.system-function-map strong {
  color: var(--text-primary);
}

.system-table-grid span,
.system-function-map span {
  color: var(--text-secondary);
  line-height: 1.7;
}

.system-function-map i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--border-radius);
  background: #fef3c7;
  color: var(--primary-hover);
}


.section-heading {
  display: grid;
  gap: 0.25rem;
}

.section-heading.os-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading.os-section-heading p {
  max-width: none;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .section-heading.os-section-heading {
    display: grid;
    align-items: start;
  }

  .section-heading.os-section-heading p {
    text-align: left;
    white-space: normal;
  }
}
.detail-tab {
  padding: 0.55rem 0.8rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.detail-tab.active {
  border-color: var(--primary-color);
  color: var(--primary-hover);
}

.detail-panel {
  display: none;
  padding-top: 0.75rem;
}

.detail-panel.active {
  display: block;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.info-grid > div {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem;
}

.workflow-strip,
.status-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.workflow-strip span {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: #eef2ff;
  font-weight: 800;
}

.status-panel > div {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: #f8fafc;
}

.status-ok {
  color: var(--success-color);
}

.status-bad {
  color: var(--error-color);
}

.btn-warning {
  background: var(--warning-color);
  color: white;
}

.btn-danger {
  background: var(--error-color);
  color: white;
}

.hidden-support-fields {
  display: none;
}

.permission-hidden {
  display: none !important;
}

.current-user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
  min-width: 0;
}

.current-user-box span {
  max-width: 180px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-user-box .btn-small {
  min-height: 28px;
  padding: 0.28rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1;
}

.current-user-box small {
  color: var(--text-secondary);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.permission-group {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #f8fafc;
}

.permission-group span {
  font-family: monospace;
  font-size: 0.85rem;
}

.permission-admin-root {
  display: grid;
  gap: var(--space-module);
}

.permission-admin-summary {
  margin-bottom: 0;
}

.permission-admin-user-table td:first-child strong,
.permission-admin-user-table td:first-child small {
  display: block;
}

.permission-admin-user-table td:first-child small {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.permission-admin-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.permission-admin-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 30px;
  padding: 0.28rem 0.48rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 0.82rem;
  line-height: 1.25;
}

.permission-admin-check input {
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.permission-admin-role-matrix {
  display: grid;
  gap: var(--space-module);
}

.permission-admin-role-card {
  display: grid;
  gap: 0.85rem;
  padding: var(--space-module);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
}

.permission-admin-role-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.permission-admin-role-head h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.permission-admin-role-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.permission-admin-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.permission-admin-group {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: #fbfbfa;
}

.permission-admin-group strong {
  font-size: 0.88rem;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .permission-admin-role-head {
    display: grid;
  }

  .permission-admin-groups {
    grid-template-columns: 1fr;
  }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 3vw, 3rem);
  background:
    linear-gradient(rgba(15, 23, 42, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.016) 1px, transparent 1px),
    radial-gradient(circle at 18% 22%, rgba(139, 115, 85, 0.046), transparent 30%),
    linear-gradient(135deg, #f2f2ef 0%, #e7e9e5 100%);
  background-size: 44px 44px, 44px 44px, auto, auto;
}

.login-card {
  width: min(1040px, 100%);
  min-height: min(660px, calc(100vh - 6rem));
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: clamp(1.5rem, 4vw, 4.5rem);
  align-items: stretch;
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid rgba(71, 85, 105, 0.16);
  border-radius: 28px;
  background: rgba(250, 250, 248, 0.54);
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(18px);
}

.login-language-row {
  display: flex;
  justify-content: flex-end;
}

.login-runtime-surface {
  position: relative;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  overflow: hidden;
  padding: clamp(2rem, 4.6vw, 3.9rem);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(247, 247, 244, 0.9), rgba(234, 235, 231, 0.74)),
    linear-gradient(rgba(15, 23, 42, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.022) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

.login-runtime-surface::after {
  content: "";
  position: absolute;
  inset: auto clamp(1.2rem, 5vw, 3.2rem) clamp(5.6rem, 11vw, 7.8rem) auto;
  width: min(210px, 42%);
  height: 126px;
  border: 1px solid rgba(100, 116, 139, 0.055);
  border-radius: 14px;
  background:
    radial-gradient(circle at 24px 24px, rgba(82, 72, 60, 0.16) 0 1px, transparent 2px),
    radial-gradient(circle at calc(100% - 28px) 34px, rgba(82, 72, 60, 0.11) 0 1px, transparent 2px),
    radial-gradient(circle at 58% calc(100% - 26px), rgba(82, 72, 60, 0.12) 0 1px, transparent 2px),
    linear-gradient(135deg, transparent 0 48%, rgba(100, 116, 139, 0.065) 49% 50%, transparent 51%),
    linear-gradient(28deg, transparent 0 50%, rgba(100, 116, 139, 0.052) 51% 52%, transparent 53%);
  opacity: 0.28;
  pointer-events: none;
}

.login-brand,
.login-brand-row {
  display: grid;
  gap: 1.15rem;
}

.login-brand-row {
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  padding: clamp(0.6rem, 1.5vw, 1rem) 0 0 clamp(0.35rem, 1.5vw, 1rem);
}

.login-brand .logo {
  width: min(280px, 80vw);
  height: auto;
  max-height: 72px;
  object-fit: contain;
}

.login-brand-row .logo {
  width: min(330px, 82vw);
  height: auto;
  max-height: 132px;
  object-fit: contain;
}

.login-brand .login-logo-svg {
  width: min(280px, 80vw);
  max-height: 72px;
  display: grid;
  place-items: center;
}

.login-brand .login-logo-svg svg {
  width: 100%;
  max-height: 72px;
  display: block;
}

.login-brand h1,
.login-brand-row h1 {
  margin: 0;
  color: #16181d;
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0;
}

.login-platform-subtitle {
  margin: 0.05rem 0 0 0.18rem;
  color: var(--text-secondary);
  font-size: clamp(0.88rem, 1.2vw, 1rem);
  font-weight: 600;
  letter-spacing: 0;
}

.login-runtime-note {
  position: relative;
  z-index: 1;
  display: grid;
  justify-self: start;
  min-width: min(300px, 100%);
  gap: 0.34rem;
  padding: 1rem 1.02rem;
  border: 1px solid rgba(71, 85, 105, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  color: var(--text-secondary);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.login-runtime-note strong {
  color: rgba(36, 32, 27, 0.7);
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: 0;
}

.login-runtime-note small {
  color: rgba(85, 95, 109, 0.58);
  font-size: 0.71rem;
  line-height: 1.35;
}

.login-access-layer {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1.35rem, 3vw, 2.1rem);
  align-content: center;
  padding: clamp(1.35rem, 4vw, 3.1rem) clamp(0.75rem, 2.4vw, 2.1rem);
}

.login-access-heading {
  align-self: end;
  display: grid;
  gap: 0.4rem;
}

.login-access-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.68;
}

.login-access-heading h2 {
  margin: 0;
  color: rgba(21, 23, 27, 0.9);
  font-size: clamp(1.48rem, 2.25vw, 1.95rem);
  font-weight: 650;
  letter-spacing: 0;
}

.login-slogan {
  margin: 0;
  color: var(--text-color);
  font-size: 0.98rem;
  line-height: 1.5;
}

.login-slogan.muted {
  color: var(--text-secondary);
}

.login-runtime-signature {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.64rem;
  line-height: 1.35;
  text-align: right;
  opacity: 0.34;
}

.login-platform-identity {
  display: grid;
  justify-items: end;
  gap: 0.12rem;
  color: rgba(85, 95, 109, 0.68);
  line-height: 1.25;
  text-align: right;
}

.login-platform-identity strong {
  color: rgba(36, 32, 27, 0.68);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-platform-identity span,
.login-platform-identity small {
  font-size: 0.66rem;
  opacity: 0.62;
}

.home-runtime-footer {
  position: fixed;
  right: clamp(18px, 2.5vw, 36px);
  bottom: clamp(14px, 2vw, 28px);
  z-index: 50;
  display: inline-flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  color: rgba(71, 85, 105, 0.78);
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
  white-space: nowrap;
}

.executive-framework-footer {
  position: fixed;
  right: clamp(18px, 2.5vw, 36px);
  bottom: clamp(14px, 2vw, 28px);
  z-index: 50;
  display: inline-flex;
  justify-self: end;
  align-self: end;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  color: rgba(71, 85, 105, 0.78);
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
  pointer-events: none;
  white-space: nowrap;
}

.login-body .login-form {
  align-self: center;
  gap: 1.18rem;
}

.login-body .form-group {
  gap: 0.38rem;
}

.login-body .form-group label {
  color: rgba(85, 95, 109, 0.52);
  font-size: 0.68rem;
  font-weight: 600;
}

.login-body .login-form input {
  min-height: 52px;
  border-color: rgba(71, 85, 105, 0.095);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.46);
  color: #15171b;
  font-size: 0.98rem;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.login-body .login-form input::placeholder {
  color: rgba(100, 116, 139, 0.36);
}

.login-body .login-form input:focus {
  border-color: rgba(83, 70, 52, 0.22);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(83, 70, 52, 0.044);
}

.login-body .password-toggle {
  right: 9px;
  color: #687386;
}

.login-body .password-toggle:hover {
  background: rgba(83, 70, 52, 0.08);
  color: #28231d;
}

.login-body .login-form .btn-primary {
  min-height: 48px;
  margin-top: 0.35rem;
  border: 1px solid var(--theme-button-accent);
  border-radius: 16px;
  background: var(--theme-button-accent);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  font-weight: 650;
}

.login-body .login-form .btn-primary:hover {
  border-color: var(--theme-button-accent-hover);
  background: var(--theme-button-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(52, 43, 34, 0.08);
}

.login-body .executive-login-shell {
  border: 1px solid rgba(71, 85, 105, 0.16);
  border-radius: 28px;
  background: rgba(250, 250, 248, 0.54);
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.09);
}

@media (max-width: 820px) {
  .login-body {
    align-items: start;
    padding: 1rem;
  }

  .login-body .executive-login-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 0;
    border-radius: 22px;
  }

  .login-runtime-surface {
    min-height: 220px;
    padding: 1.35rem;
    border-radius: 18px;
  }

  .login-runtime-note {
    display: none;
  }

  .login-brand-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
  }

  .login-brand-row .logo {
    width: min(260px, 76vw);
    height: auto;
    max-height: 104px;
  }

  .login-access-layer {
    padding: 1.35rem 0.45rem 0.65rem;
  }

  .login-runtime-signature {
    text-align: center;
  }

  .login-platform-identity {
    justify-items: center;
    text-align: center;
  }
}

.logo-config-section {
  gap: 0.75rem;
}

.theme-config-section {
  gap: 0.75rem;
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 220px));
  gap: 0.85rem;
}

.theme-config-form input[type="color"] {
  width: 100%;
  max-width: 220px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #fff;
  cursor: pointer;
}

.theme-preview-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: #f8fafc;
}

.theme-preview-sidebar {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.9rem;
  border-radius: 8px;
  background: var(--theme-sidebar-bg);
  color: var(--ds-card);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--theme-sidebar-accent);
}


@media (max-width: 1080px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.system-dev-snapshot-panel {
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: #ffffff;
}

.system-dev-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.snapshot-mode-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.snapshot-mode-actions {
  align-items: center;
  flex-wrap: wrap;
}

.snapshot-manual-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.system-dev-snapshot-item {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.system-dev-snapshot-item span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 6px;
}

.system-dev-snapshot-item strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.system-dev-snapshot-result {
  margin-top: 14px;
}

.system-dev-snapshot-result h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #334155;
}

.system-dev-snapshot-result pre {
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  white-space: pre-wrap;
}

.snapshot-manual-list {
  display: grid;
  gap: 8px;
}

.snapshot-manual-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #f8fafc;
}

.snapshot-manual-item strong,
.snapshot-manual-item span,
.snapshot-manual-item small {
  overflow-wrap: anywhere;
}

.snapshot-manual-item span,
.snapshot-manual-item small {
  color: #64748b;
}




.legacy-source-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.legacy-source-vitalveil {
  border: 1px solid #f0abfc;
  background: #fdf4ff;
  color: #a21caf;
}

.legacy-source-trailtrek {
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.legacy-source-generic,
.legacy-source-unknown {
  border: 1px solid #d0d5dd;
  background: #f2f4f7;
  color: #475467;
}

.legacy-source-filter {
  min-width: 150px;
}

.quick-delete-action,
.pm-quick-delete-button {
  border-color: #b91c1c !important;
  background: #b91c1c !important;
  color: #fff !important;
}

th.vlingo-money-col,
td.vlingo-money-col,
th.amount-cell,
td.amount-cell,
th.money-cell,
td.money-cell,
th.price-cell,
td.price-cell,
th.currency-cell,
td.currency-cell,
th.numeric-cell,
td.numeric-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.status-pill.rejected {
  background: rgba(217, 48, 37, 0.12);
  color: #d93025;
  border: 1px solid rgba(217, 48, 37, 0.24);
}

/* ===== Visual Framework Phase 1 Convergence ===== */
:root {
  --vf-primary: var(--theme-button-accent);
  --vf-primary-hover: var(--theme-button-accent-hover);
  --vf-primary-soft: color-mix(in srgb, var(--theme-button-accent) 12%, transparent);
  --vf-focus-ring: rgb(231 138 47 / 0.25);
  --vf-control-radius: var(--ds-radius);
  --vf-control-gap: 0.5rem;
}

/* 统一按钮体系：主按钮统一为设计色，减少页面级蓝色与离散样式 */
.btn,
button.btn,
input.btn,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--vf-control-gap);
  min-height: 40px;
  height: 40px;
  padding: 0 1rem;
  border-radius: var(--vf-control-radius);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.1;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:focus-visible,
button.btn:focus-visible,
input.btn:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--vf-focus-ring);
}

.btn:hover:not(:disabled),
button.btn:hover:not(:disabled),
input.btn:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled),
input[type="button"]:hover:not(:disabled),
input[type="reset"]:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary,
.btn-success,
.btn-main,
button.btn-primary,
button.btn-success {
  background: var(--theme-button-accent);
  border-color: var(--theme-button-accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-main:hover:not(:disabled),
button.btn-primary:hover:not(:disabled),
button.btn-success:hover:not(:disabled) {
  background: var(--theme-button-accent-hover);
  border-color: var(--theme-button-accent-hover);
}

.btn-secondary,
.btn-outline {
  background: #fff;
  border-color: var(--ds-border);
  color: var(--ds-text);
}

.btn-secondary:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
  border-color: var(--vf-primary);
  background: var(--vf-primary-soft);
  color: var(--vf-primary);
}

.btn-small {
  min-height: 34px;
  height: 34px;
  padding-inline: 0.72rem;
  font-size: 0.875rem;
}

.actions,
.list-panel-actions,
.row-actions,
.course-row-actions,
.approval-detail-actions,
.payment-actions,
.table-actions,
.vlingo-card-actions,
.course-filter-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 表格框架：对齐、空值、ellipsis、action 区 */
table,
.settings-table,
.audit-table,
.order-table,
.tidy-preview-table,
.pm-table,
.pm-table-wrap table,
table.vlingo-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--ds-border);
  background: var(--ds-card);
}

table th,
table td,
.settings-table th,
.settings-table td,
.audit-table th,
.audit-table td,
.order-table th,
.order-table td,
.pm-table th,
.pm-table td,
.table-cell th,
.table-cell td,
.vlingo-table th,
.vlingo-table td {
  padding: 0.72rem 0.78rem;
  border-bottom: 1px solid var(--ds-border);
  text-align: left;
  vertical-align: middle;
  background: inherit;
  color: var(--ds-text);
}

table tr:last-child th,
table tr:last-child td {
  border-bottom: 0;
}

th,
.settings-table th,
.audit-table th,
.order-table th,
.tidy-preview-table th,
.pm-table th,
.table-cell th {
  background: var(--ds-card-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: var(--ds-font-weight-bold);
}

td:empty::before,
.empty-cell::before,
.table-cell-empty::before,
.vlingo-empty::before {
  content: "-";
  color: var(--ds-text-muted);
  font-weight: normal;
  opacity: 0.95;
}

th.cell-actions,
td.cell-actions,
th.row-actions,
td.row-actions,
.actions-cell,
td[role="gridcell"].cell-actions {
  text-align: right;
  white-space: nowrap;
}

th[class*="ellipsis"],
td[class*="ellipsis"],
.table-cell-ellipsis {
  max-width: 260px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

th[class*="ellipsis"]:hover,
td[class*="ellipsis"]:hover,
.table-cell-ellipsis:hover {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  word-break: break-word;
  z-index: 2;
}

th[class*="ellipsis"][title],
td[class*="ellipsis"][title],
.table-cell-ellipsis[title] {
  cursor: help;
}

.text-number,
.text-currency,
.text-percent,
.amount-cell,
.money-cell,
.currency-cell,
.numeric-cell,
.vlingo-money-col,
.cell-number,
.cell-currency,
th.text-number,
td.text-number,
th.vlingo-money-col,
td.vlingo-money-col {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* 表单体系：统一表单控件，统一 focus 与提示层 */
input,
select,
textarea,
.vlingo-input {
  min-height: 40px;
  border: 1px solid var(--ds-border);
  border-radius: var(--vf-control-radius);
  padding: 0.7rem 0.86rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.35;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

select {
  min-height: 42px;
  height: 42px;
  line-height: 1.4;
  padding-top: 9px;
  padding-bottom: 9px;
}

input:focus,
select:focus,
textarea:focus,
.vlingo-input:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.vlingo-input:focus-visible {
  outline: none;
  border-color: var(--vf-primary);
  box-shadow: 0 0 0 3px var(--vf-focus-ring);
}

label,
.form-group label {
  color: var(--ds-text);
  font-weight: var(--ds-font-weight-medium);
  margin-bottom: 0.35rem;
}

.field-hint,
.form-hint,
.input-hint,
.validation-message,
.validation-error,
.field-error,
.field-message {
  margin-top: 0.35rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.field-error,
.validation-error,
.inline-message.error {
  color: var(--error-color);
}

input::placeholder,
textarea::placeholder,
select::placeholder {
  color: var(--text-muted);
}

.localized-file-wrapper,
.file-upload,
.upload-area,
.upload-zone,
.vlingo-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0.75rem;
}

/* 卡片体系 */
.section,
.settings-panel,
.course-category-panel,
.course-category-form,
.stat-card,
.info-grid > div,
.permission-group,
.login-card,
.retail-panel,
.vocabulary-review-card,
.module-card,
.learning-word-card,
.learning-complete-card,
.cockpit-card,
.inline-card,
.card,
.panel,
.finance-panel,
.table-panel {
  border: 1px solid var(--ds-border);
  border-radius: var(--vf-control-radius);
  background: var(--ds-card);
  box-shadow: var(--ds-shadow-sm);
}

.section,
.settings-panel,
.course-category-panel,
.course-category-form,
.retail-panel,
.finance-panel,
.table-panel,
.card,
.panel {
  padding: var(--ds-space-6);
}

.section h2,
.section h3,
.card-title,
.panel-title,
.retail-panel h2,
.finance-panel h2 {
  margin: 0 0 0.65rem;
  color: var(--ds-text);
  line-height: 1.3;
}

.section p.subtitle,
.section .subtitle,
.card-subtitle,
.panel-subtitle {
  color: var(--ds-text-muted);
  margin: 0.2rem 0 0.8rem;
}

/* 弹窗与 toast */
.modal-overlay,
.popup-overlay,
.app-modal,
.app-modal-wrap,
.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(15 23 42 / 0.45);
}

.modal-panel,
.popup,
#vocabEditModal .modal-panel,
.app-modal-panel {
  width: min(680px, 100%);
  max-width: calc(100% - 2rem);
  background: var(--ds-card);
  border: 1px solid var(--ds-border);
  border-radius: var(--vf-control-radius);
  box-shadow: var(--ds-shadow);
  padding: 1.1rem;
}

.modal-header,
.app-modal-header,
.vocab-edit-head,
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

.modal-header h3,
.app-modal-header h3,
.popup h2 {
  margin: 0;
}

.modal-footer,
.app-modal-actions,
.popup-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

.modal-close,
button.modal-close,
.app-modal-close,
[data-modal-close] {
  border: 0;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  background: transparent;
  color: var(--ds-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#vlingo-auth-toast,
.vlingo-toast,
.toast,
.app-toast,
.system-toast {
  position: fixed !important;
  left: 50% !important;
  bottom: 16px !important;
  transform: translateX(-50%) !important;
  max-width: min(92vw, 860px) !important;
  padding: 10px 14px !important;
  border-radius: 8px !important;
  background: var(--ds-slate, #0f172a) !important;
  color: #fff !important;
  font-size: 14px !important;
  z-index: 9999 !important;
  text-align: center !important;
  box-shadow: 0 10px 22px rgb(15 23 42 / 0.3) !important;
  word-break: break-word !important;
}

/* 空状态 / 异常 / 加载态 */
.empty-state,
.empty-cell,
.empty-view,
.retail-overview-state.empty,
.retail-state.empty,
.inline-message.is-empty {
  color: var(--ds-text-muted);
}

.empty-state,
.inline-message,
.retail-overview-state,
.retail-status-footer,
.retail-state,
.pm-inline-error,
.app-inline-state {
  border-radius: var(--vf-control-radius);
  padding: 0.75rem 0.9rem;
}

.loading,
.is-loading,
div.loading,
span.loading,
.retail-state.loading,
.retail-overview-state.loading {
  color: var(--vf-primary);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.loading::before,
.is-loading::before,
.retail-state.loading::before,
.retail-overview-state.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgb(231 138 47 / 0.28);
  border-top-color: var(--vf-primary);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.error,
.is-error,
.inline-message.error,
.status.error,
.retail-state.error {
  color: var(--error-color);
}

.failure,
.app-failure,
.toast-error,
.retail-state.failure,
.request-error,
.net-error {
  color: var(--error-color);
}

/* 通用状态文本规范：禁止裸露系统级字样 */
.inline-message:not(:empty),
.retail-state:not(:empty) {
  min-height: 38px;
  align-items: center;
}

.empty-state,
.inline-message,
.inline-message.success,
.inline-message.error,
.retail-state,
#retailOverviewState,
#retail-overview-state,
.pm-inline-success {
  border: 1px dashed var(--ds-border);
  background: var(--ds-card-muted);
}

/* 收口辅助 */
.retail-overview-state,
.retail-status-footer,
.retail-state {
  line-height: 1.5;
}

/* AEOS runtime UI baseline - compact, low saturation runtime/governance surfaces */
.status-tag,
.status-badge,
.badge,
.count-badge,
.course-status-badge,
.os-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: var(--theme-radius-pill);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.status-tag.status-ok,
.status-tag.healthy,
.status-ok,
.course-status-badge.valid,
.os-status-badge.active {
  border-color: #bbf7d0;
  background: var(--theme-color-success-bg);
  color: var(--theme-color-success-text);
}

.status-tag.status-warning,
.status-tag.warning,
.status-tag.degraded,
.status-warning,
.course-status-badge.pending,
.os-status-badge.planned,
.warn-text {
  border-color: #fde68a;
  background: var(--theme-color-warning-bg);
  color: var(--theme-color-warning-text);
}

.status-tag.status-bad,
.status-tag.critical,
.status-tag.blocked,
.status-tag.unsafe,
.status-bad,
.course-status-badge.error,
.error-cell {
  border-color: #fecaca;
  background: var(--theme-color-danger-bg);
  color: var(--theme-color-danger-text);
}

.status-tag.neutral,
.status-badge.neutral,
.badge.neutral {
  border-color: var(--theme-color-border);
  background: var(--theme-color-card-muted);
  color: var(--theme-color-muted);
}

.runtime-intelligence-card,
.runtime-intelligence-panel,
.os-health-metric-card,
.os-health-source-card,
.governance-summary-card,
.runtime-event-item,
.runtime-console-item,
.runtime-warning-item,
.runtime-residual-item {
  border-color: var(--theme-color-border);
  border-radius: var(--theme-radius-card);
}

.runtime-intelligence-card,
.os-health-metric-card,
.os-health-source-card,
.governance-summary-card {
  padding: 12px;
}

.runtime-intelligence-panel {
  padding: 14px;
}

.runtime-event-item,
.runtime-console-item,
.runtime-warning-item,
.runtime-residual-item {
  padding: 10px 12px;
}

.runtime-intelligence-filters select,
.course-filter-bar select,
.filter-bar select,
.sales-outbound-toolbar select,
.payment-filters select,
.list-filters select,
.settings-table select,
select {
  min-height: 42px;
  height: 42px;
  line-height: 1.4;
  padding-top: 9px;
  padding-bottom: 9px;
  vertical-align: middle;
}

.btn,
button.btn,
input.btn {
  min-height: 40px;
  align-items: center;
}

.btn-small {
  min-height: 34px;
}

.empty-state,
.empty-cell,
.empty-view {
  border: 1px dashed #d8e1ee;
  border-radius: var(--theme-radius-card);
  background: var(--theme-color-card-muted);
  color: var(--theme-color-muted);
  padding: 12px;
}

.runtime-event-drawer-panel {
  padding: 20px;
}

.runtime-event-drawer-panel h3 {
  margin: 0 40px 14px 0;
  color: var(--theme-color-text);
  font-size: 18px;
  line-height: 1.3;
}

.section-heading.compact-heading {
  gap: 12px;
}

.runtime-surface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.runtime-surface-card {
  min-height: 0;
}

.runtime-metric-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.runtime-metric {
  border: 1px solid var(--theme-color-border);
  border-radius: 8px;
  background: var(--theme-color-card-muted);
  padding: 9px 10px;
}

.runtime-metric span {
  display: block;
  color: var(--theme-color-muted);
  font-size: 12px;
  line-height: 1.3;
}

.runtime-metric strong {
  display: block;
  margin-top: 2px;
  color: var(--theme-color-text);
  font-size: 18px;
  line-height: 1.2;
  word-break: break-word;
}

.runtime-metric-warning {
  border-color: #fde68a;
  background: var(--theme-color-warning-bg);
}

.runtime-metric-critical {
  border-color: #fecaca;
  background: var(--theme-color-danger-bg);
}

.runtime-item-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.runtime-item-link {
  border: 1px solid var(--theme-color-border);
  border-radius: var(--theme-radius-card);
  background: var(--theme-color-surface);
  color: var(--theme-color-text);
  padding: 9px 10px;
  text-decoration: none;
}

.runtime-switch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.runtime-empty-state {
  margin-top: 12px;
}
