@import url("https://fonts.googleapis.com/css2?family=Reem+Kufi+Ink&display=swap");

:root {
  --bg: #f6f8fb;
  --bg-2: #edf3f8;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: #f8fafc;
  --surface-3: #ffffff;
  --panel-bg: var(--surface);
  --metadata-bg: #f8fafc;
  --text: #132033;
  --muted: #607086;
  --border: #d8e1ea;
  --border-strong: #b8c5d3;
  --accent: #0f766e;
  --accent-strong: #4f46e5;
  --success: #16865f;
  --warning: #b7791f;
  --danger: #c2415b;
  --success-soft: rgba(22, 134, 95, 0.1);
  --success-border: rgba(22, 134, 95, 0.22);
  --warning-soft: rgba(183, 121, 31, 0.12);
  --warning-border: rgba(183, 121, 31, 0.28);
  --danger-soft: rgba(194, 65, 91, 0.1);
  --danger-border: rgba(194, 65, 91, 0.25);
  --shadow: 0 18px 44px rgba(32, 46, 66, 0.09);
  --shadow-soft: 0 8px 22px rgba(32, 46, 66, 0.08);
  --accent-halo: rgba(15, 118, 110, 0.13);
  --panel-border: rgba(208, 219, 230, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-faint: rgba(79, 70, 229, 0.08);
  --accent-border: rgba(15, 118, 110, 0.34);
  --metadata-top: rgba(248, 250, 252, 0.98);
  --metadata-bottom: rgba(241, 245, 249, 0.98);
  --input-bg: #ffffff;
  --card-bg: #ffffff;
  --card-border: #dce5ee;
  --chip-bg: #f3f7fb;
  --cell-border: #bed0df;
  --cell-bg-top: #ffffff;
  --cell-bg-bottom: #e9f3f7;
  --empty-cell-a: #eef3f7;
  --empty-cell-b: #e3ebf3;
  --coord-color: rgba(19, 32, 51, 0.42);
  --focus-outline: rgba(15, 118, 110, 0.26);
  --random-outline: #f59e0b;
  --muted-soft: rgba(96, 112, 134, 0.13);
  --preview-shell-top: rgba(15, 118, 110, 0.09);
  --preview-shell-bottom: rgba(79, 70, 229, 0.06);
  --backdrop: rgba(15, 23, 42, 0.44);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --font-ui: "Cairo", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  --focus-ring: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

:root[data-theme="dark"] {
  --bg: #111317;
  --bg-2: #181b20;
  --surface: rgba(27, 31, 37, 0.96);
  --surface-2: #20252c;
  --surface-3: #242a32;
  --panel-bg: var(--surface);
  --metadata-bg: #20252c;
  --text: #edf2f7;
  --muted: #9aa8b8;
  --border: #323a45;
  --border-strong: #485565;
  --accent: #2dd4bf;
  --accent-strong: #8b8cf8;
  --success: #69d39e;
  --warning: #f2b84b;
  --danger: #fb7185;
  --success-soft: rgba(105, 211, 158, 0.14);
  --success-border: rgba(105, 211, 158, 0.28);
  --warning-soft: rgba(242, 184, 75, 0.14);
  --warning-border: rgba(242, 184, 75, 0.28);
  --danger-soft: rgba(251, 113, 133, 0.13);
  --danger-border: rgba(251, 113, 133, 0.28);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.22);
  --accent-halo: rgba(45, 212, 191, 0.16);
  --panel-border: rgba(57, 66, 79, 0.92);
  --nav-bg: rgba(22, 25, 30, 0.72);
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-faint: rgba(139, 140, 248, 0.1);
  --accent-border: rgba(45, 212, 191, 0.36);
  --metadata-top: rgba(32, 37, 44, 0.96);
  --metadata-bottom: rgba(27, 31, 37, 0.96);
  --input-bg: #161a20;
  --card-bg: #1d2229;
  --card-border: #34404d;
  --chip-bg: #202733;
  --cell-border: #405165;
  --cell-bg-top: #26303a;
  --cell-bg-bottom: #1c242d;
  --empty-cell-a: #202832;
  --empty-cell-b: #172029;
  --coord-color: rgba(237, 242, 247, 0.36);
  --focus-outline: rgba(45, 212, 191, 0.25);
  --random-outline: #e0a85f;
  --muted-soft: rgba(198, 184, 170, 0.12);
  --preview-shell-top: rgba(45, 212, 191, 0.13);
  --preview-shell-bottom: rgba(139, 140, 248, 0.08);
  --backdrop: rgba(0, 0, 0, 0.48);
  --focus-ring: 0 0 0 3px rgba(45, 212, 191, 0.18);
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: 12px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transform: translateY(-120%);
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: var(--focus-ring), var(--shadow);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-size: 34px 34px, 34px 34px, auto;
  color: var(--text);
}

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

.app-layout {
  min-height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(250px, 286px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  padding: clamp(14px, 2vw, 24px);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: clamp(14px, 2vw, 24px);
  align-self: start;
  display: grid;
  gap: 14px;
}

.brand-card,
.panel,
.app-dialog {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-card {
  position: relative;
  padding: 20px;
  overflow: hidden;
}

.brand-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong), var(--warning));
  opacity: 0.85;
}

.brand-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: 1px solid var(--accent-border);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 22px var(--accent-halo);
}

.brand-mark__glyph {
  font-size: 1.25rem;
  line-height: 1;
  color: #fff;
  filter: saturate(1.1);
}

.brand-card h1 {
  margin: 0 0 10px;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

.brand-subtitle,
.brand-card p.brand-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.workspace-nav {
  display: grid;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-xl);
  background: var(--nav-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  gap: 10px;
  text-align: start;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition:
    background 0.2s var(--ease-soft),
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    transform 0.2s var(--ease-out);
}

.nav-btn__icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.95;
  font-size: 1.05em;
}

.nav-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  transform: translateX(-2px);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-faint));
  border-color: var(--accent-border);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 800;
}

.nav-btn.active .nav-btn__icon {
  opacity: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
}

.main-content {
  display: grid;
  min-width: 0;
  padding-bottom: 48px;
}

.workspace-page {
  display: none;
}

.workspace-page.active {
  display: block;
  animation: page-enter 0.34s var(--ease-out) both;
}

.panel {
  padding: clamp(18px, 1.8vw, 24px);
  margin-bottom: 14px;
  transition:
    box-shadow 0.25s var(--ease-out),
    border-color 0.25s var(--ease-out);
  animation: surface-enter 0.34s var(--ease-out) both;
}

.panel:hover {
  border-color: var(--border-strong);
}

.panel-head,
.toolbar,
.button-row,
.group-card-main,
.level-head,
.analysis-compact-row,
.dialog-head,
.builder-top-row,
.builder-mid-row,
.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.stacked-toolbars {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.stacked-toolbars + #groupsMessage,
.stacked-toolbars + .status-box {
  margin-top: 12px;
}

.filter-toolbar {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 160px;
}

.filter-field.grow {
  flex: 1 1 200px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
  line-height: 1.3;
}

.locale-toolbar .filter-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.input-stretch {
  flex: 1;
  min-width: 0;
}

.panel-head h2,
.panel-head h3,
.result-card h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.panel-head h2 {
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.4rem);
}

.dialog-head {
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  gap: 12px 16px;
}

.dialog-head h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.panel-footer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

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

.builder-top-row {
  margin-top: 18px;
  align-items: stretch;
}

.builder-target-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
  gap: 16px;
  margin-top: 18px;
}

.builder-top-row .field-block {
  flex: 1 1 240px;
}

.builder-mid-row {
  margin-top: 16px;
  align-items: stretch;
}

.metadata-section {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--metadata-top), var(--metadata-bottom));
  border: 1px solid var(--border);
}

:root[data-theme="dark"] .metadata-section {
  background: linear-gradient(180deg, var(--metadata-top), var(--metadata-bottom));
}

.metadata-grid {
  margin-top: 14px;
}

.settings-subhead {
  margin-top: 24px;
}

.builder-mid-row .wide {
  flex: 1 1 520px;
}

.side-stack {
  flex: 1 1 300px;
  display: grid;
  gap: 10px;
}

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

.field-block,
.result-card,
.compact-summary {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.field-block {
  background: color-mix(in srgb, var(--surface-3) 74%, var(--surface-2));
}

.result-card,
.compact-summary {
  box-shadow: var(--shadow-soft);
}

.field-block label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
  color: var(--text);
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.field-header label {
  margin-bottom: 0;
}

.field-block input,
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  transition:
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    background-color 0.2s var(--ease-soft);
}

.field-block input:focus-visible,
.field-block textarea:focus-visible,
.field-block select:focus-visible,
.filter-toolbar input:focus-visible,
.filter-toolbar select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

:root[data-theme="dark"] .field-block input,
:root[data-theme="dark"] .field-block textarea,
:root[data-theme="dark"] .field-block select,
:root[data-theme="dark"] .filter-toolbar input,
:root[data-theme="dark"] .filter-toolbar select,
:root[data-theme="dark"] .nav-btn {
  background: var(--input-bg);
}

.field-block textarea {
  resize: vertical;
  min-height: 180px;
}

.hidden-input-store {
  display: none;
}

.editor-list,
.image-editor-list,
.hint-editor-list,
.hint-lines {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  min-height: 56px;
}

.editor-empty,
.image-entry,
.hint-editor-card,
.hint-line {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

:root[data-theme="dark"] .editor-empty,
:root[data-theme="dark"] .image-entry,
:root[data-theme="dark"] .hint-editor-card,
:root[data-theme="dark"] .hint-line {
  background: var(--card-bg);
  border-color: var(--card-border);
}

.image-entry,
.hint-line,
.hint-editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.image-entry input,
.hint-line input {
  flex: 1 1 260px;
  min-width: 0;
}

.media-preview {
  width: 72px;
  height: 54px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: var(--radius-xs);
  border: 1px solid var(--card-border);
  background: var(--surface-3);
}

.media-preview a,
.media-preview img {
  display: block;
  width: 100%;
  height: 100%;
}

.media-preview img {
  object-fit: cover;
}

.media-preview.hidden {
  display: none;
}

.media-preview-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.hint-editor-card strong {
  font-size: 1rem;
}

.wide,
.wide-card {
  width: 100%;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.toggle-row input {
  width: auto;
  margin: 0;
}

.shared-count-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-weight: 700;
}

.shared-count-field input {
  width: 80px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
}

.hint,
.meta-note,
.muted {
  color: var(--muted);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.option-chip {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-btn,
.secondary-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 20px var(--accent-halo);
  transition:
    filter 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    transform 0.15s var(--ease-out);
}

.primary-btn:hover {
  filter: brightness(1.04);
  box-shadow: 0 14px 26px var(--accent-halo);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: scale(0.99);
  filter: brightness(0.97);
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  font-weight: 800;
  transition:
    background 0.2s var(--ease-soft),
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    transform 0.15s var(--ease-out);
}

.secondary-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: scale(0.99);
}

.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.nav-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.primary-btn:focus-visible {
  box-shadow: var(--focus-ring), 0 2px 8px var(--accent-halo);
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  justify-content: center;
  background: var(--surface-2);
  color: var(--danger);
  border-color: var(--border);
}

.small-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.92rem;
}

.btn-icon {
  font-size: 0.95rem;
}

.status-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.8;
  border: 1px solid transparent;
  font-weight: 700;
}

.status-success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.status-warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.status-error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.toast-stack {
  position: fixed;
  inset: auto 20px 24px auto;
  z-index: 2000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 800;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  animation: toast-in 180ms ease-out both;
  cursor: pointer;
}

.toast-message.status-success {
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, 0.32);
  color: #047857;
}

.toast-message.status-warning {
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.34);
  color: #92400e;
}

.toast-message.status-error {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.34);
  color: #b91c1c;
}

.toast-message.is-hiding {
  animation: toast-out 200ms ease-in both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.stats-list,
.word-list,
.notice-list,
.paths-list,
.random-word-box,
.group-list,
.levels-list,
.backup-list,
.variants-list,
.stats-cards-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stats-cards-grid,
.variants-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-row,
.word-row,
.notice-item,
.path-item,
.random-card,
.group-card,
.level-card,
.level-type-card,
.stat-card,
.variant-card {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

:root[data-theme="dark"] .stat-row,
:root[data-theme="dark"] .word-row,
:root[data-theme="dark"] .notice-item,
:root[data-theme="dark"] .path-item,
:root[data-theme="dark"] .random-card,
:root[data-theme="dark"] .group-card,
:root[data-theme="dark"] .level-card,
:root[data-theme="dark"] .level-type-card,
:root[data-theme="dark"] .compact-summary,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .variant-card {
  background: var(--card-bg);
  border-color: var(--card-border);
}

.word-row,
.path-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.path-item {
  align-items: center;
}

.compact-summary {
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--success);
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-chip {
  padding: 10px 14px;
  background: var(--chip-bg);
  border-color: var(--border);
  font-weight: 800;
  transition:
    border-color 0.2s var(--ease-soft),
    background-color 0.2s var(--ease-soft),
    transform 0.15s var(--ease-out);
}

.option-chip:hover {
  transform: translateY(-1px);
  border-color: var(--accent-border);
}

.option-chip.recommended {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.grid-board {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  justify-content: start;
}

.grid-board.bubble-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-board-row,
.preview-bubble-row,
.mini-bubble-row {
  display: flex;
  gap: 8px;
}

.mini-bubble-row {
  gap: 3px;
}

.grid-cell {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--cell-border);
  background: linear-gradient(180deg, var(--cell-bg-top), var(--cell-bg-bottom));
  font-size: 1.35rem;
  font-weight: 800;
  position: relative;
  z-index: 2; /* To sit above path lines */
  box-shadow: 0 8px 16px rgba(32, 46, 66, 0.08);
  transition:
    transform 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out);
}

.grid-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(32, 46, 66, 0.12);
}

.grid-cell.bubble-cell,
.preview-bubble-cell,
.mini-bubble-cell {
  border-radius: 50%;
}

.grid-cell.empty-cell {
  opacity: 0.15;
  border-style: dashed;
  color: transparent;
}

.grid-cell::after {
  content: attr(data-coord);
  position: absolute;
  inset-inline-start: 6px;
  inset-block-start: 4px;
  font-size: 0.58rem;
  color: var(--coord-color);
}

.grid-cell.highlighted {
  color: white;
}

.grid-cell.swap-selected {
  outline: 3px solid var(--accent-border);
  outline-offset: -4px;
  transform: translateY(-1px);
}

.grid-cell.draft-path {
  color: white;
}

.grid-cell.draft-path-valid {
  outline: 3px solid var(--success);
  outline-offset: -4px;
}

.grid-cell.draft-path-invalid {
  outline: 3px solid var(--danger);
  outline-offset: -4px;
}

.focused-cell {
  outline: 3px solid var(--focus-outline);
  outline-offset: -4px;
}

.random-highlight {
  outline: 3px dashed var(--random-outline);
  outline-offset: -5px;
}

.legend-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.path-item.active {
  border-color: var(--border-strong);
}

.secondary-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text);
}

.inline-code {
  direction: ltr;
  unicode-bidi: plaintext;
  font-family: "SFMono-Regular", "Courier New", monospace;
  font-size: 0.92rem;
}

.group-card {
  display: grid;
  gap: 8px;
}

.group-open-btn {
  background: transparent;
  border: 0;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  padding: 0;
}

.group-card.active {
  border-color: var(--accent-border);
}

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

.level-card {
  display: grid;
  gap: 12px;
}

.level-type-card {
  display: grid;
  gap: 12px;
}

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

.backup-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.level-card.dragging {
  opacity: 0.55;
}

.badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--success);
  font-size: 0.85rem;
}

.badge-muted {
  background: var(--muted-soft);
  color: var(--muted);
}

.mini-grid {
  display: grid;
  gap: 3px;
  width: fit-content;
  direction: ltr;
}

.mini-cell {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--cell-bg-bottom);
  border: 1px solid var(--card-border);
  font-size: 0.65rem;
  font-weight: 700;
}

.mini-random-cell {
  outline: 2px dashed var(--random-outline);
  outline-offset: -3px;
}

.mini-empty-cell,
.preview-empty-cell {
  background: repeating-linear-gradient(135deg, var(--empty-cell-a), var(--empty-cell-a) 6px, var(--empty-cell-b) 6px, var(--empty-cell-b) 12px);
  border-style: dashed;
  color: transparent;
}

.preview-grid-wrap {
  overflow: auto;
  padding: 6px 0;
}

.preview-grid {
  display: grid;
  gap: 8px;
  width: fit-content;
  direction: ltr;
}

.preview-bubble-grid,
.mini-bubble-grid {
  display: flex;
  flex-direction: column;
  width: fit-content;
  direction: ltr;
}

.preview-cell {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--cell-bg-top), var(--cell-bg-bottom));
  border: 1px solid var(--cell-border);
  font-size: 1.3rem;
  font-weight: 700;
}

.preview-random-cell {
  outline: 3px dashed var(--random-outline);
  outline-offset: -5px;
}

.game-preview-shell {
  max-width: 420px;
  margin: 0 auto;
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--preview-shell-top), var(--preview-shell-bottom));
  border: 1px solid var(--border);
  display: grid;
  gap: 18px;
}

.game-preview-head {
  text-align: center;
}

.game-preview-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.game-preview-subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.game-preview-grid-wrap {
  display: grid;
  justify-content: center;
}

.game-preview-random {
  text-align: center;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.app-dialog {
  display: none;
  width: min(960px, calc(100% - 32px));
  max-height: min(90vh, 920px);
  border: 0;
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}

.app-dialog[open] {
  display: block;
  animation: dialog-in 0.22s var(--ease-out) both;
}

.app-dialog.dialog-fallback-open {
  display: block;
  animation: dialog-fallback-in 0.22s var(--ease-out) both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* لا نحرّك transform هنا لأن الـ fallback يثبت الحوار بـ translate(-50%,-50%) */
@keyframes dialog-fallback-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.app-dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(8px);
}

.app-dialog.dialog-fallback-open {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  z-index: 1000;
}

.admin-backup-dialog {
  width: min(860px, calc(100% - 32px));
}

.backup-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.backup-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  transition:
    border-color 0.18s var(--ease-out),
    background 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}

.backup-option-card:hover {
  border-color: var(--accent-border);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.backup-option-card input {
  margin-top: 5px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.backup-option-card strong,
.backup-option-card small {
  display: block;
  min-width: 0;
}

.backup-option-card strong {
  font-size: 0.96rem;
  line-height: 1.5;
}

.backup-option-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.7;
}

.backup-dashboard-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.backup-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.backup-dashboard-head strong,
.backup-dashboard-head small {
  display: block;
}

.backup-dashboard-head small,
.backup-schedule-meta {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.7;
}

.backup-schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.backup-schedule-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.backup-schedule-card__title,
.backup-schedule-card__title label,
.backup-schedule-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.backup-schedule-card__title {
  justify-content: space-between;
}

.backup-schedule-card__title label {
  font-weight: 800;
}

.backup-schedule-card__title input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.backup-schedule-fields {
  margin-top: 12px;
}

.backup-schedule-fields label,
.backup-remote-row label {
  display: grid;
  gap: 6px;
  flex: 1 1 140px;
  min-width: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.84rem;
}

.backup-schedule-fields input,
.backup-remote-row input {
  width: 100%;
  color: var(--text);
}

.backup-remote-row {
  margin-top: 12px;
}

.backup-history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.backup-history-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.backup-history-item strong {
  font-size: 0.95rem;
}

.backup-history-item span {
  color: var(--muted);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-layout {
    padding: 14px;
  }

  .form-grid,
  .results-grid,
  .builder-top-row,
  .builder-mid-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .grid-cell {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
  }

  .preview-cell {
    width: 56px;
    height: 56px;
    font-size: 1.15rem;
  }
}

.image-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  transition:
    border-color 0.2s var(--ease-soft),
    background 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft);
}

.image-dropzone:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 10px var(--accent-halo);
}

.image-dropzone:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.image-dropzone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-faint);
}

.hidden-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Upload progress bar ─────────────────────────── */
.upload-progress {
  --upload-progress-value: 0;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.upload-progress__bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}
.upload-progress__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(var(--upload-progress-value));
  transform-origin: left;
  transition: transform 0.18s ease;
}
.upload-progress.is-indeterminate .upload-progress__bar::after {
  animation: progress-pulse 1.2s ease-in-out infinite alternate;
}
.ai-generation-progress {
  margin-top: 0.85rem;
}
.contribution-loading-state .upload-progress {
  width: min(100%, 340px);
  margin: 0 auto;
}
@keyframes progress-pulse {
  from { transform: scaleX(0.15); }
  to   { transform: scaleX(0.95); }
}

/* ── Storage badge on image list item ───────────────── */
.img-storage-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-faint);
  color: var(--accent-strong);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

/* ── Random word hint upload row ─────────────────── */
.random-word-hint-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.random-hint-upload-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Upload optimization controls ─────────────────── */
.upload-settings-block {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-3);
}

.upload-file-options {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
  padding-inline-end: 2px;
}

.upload-file-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
}

.upload-file-card__head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

.upload-file-card__name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.upload-file-card__summary {
  color: var(--muted);
  font-size: 0.88rem;
}

.upload-options-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.upload-options-grid label {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.upload-options-grid input,
.upload-options-grid select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
}

.upload-options-grid .toggle-row {
  align-content: center;
  grid-template-columns: auto 1fr;
}

@media (max-width: 760px) {
  .builder-target-row {
    grid-template-columns: 1fr;
  }

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

/* AI title suggestions stay attached to the existing optional title field. */
.employee-body .employee-title-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.employee-body .employee-title-input-row > input {
  min-width: 0;
}

.employee-body .employee-answer-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.employee-body .employee-answer-field-head > label {
  margin: 0;
}

.employee-body .employee-clue-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.employee-body .employee-answer-field-head .employee-answer-suggestions-btn {
  min-height: 40px;
}

.employee-body .employee-answer-suggestions__actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--border));
}

.employee-body .employee-answer-suggestions__actions .secondary-btn {
  min-height: 38px;
}

.employee-body .employee-clue-suggestions .employee-title-suggestions__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.employee-body .employee-clue-suggestions .employee-title-suggestion {
  width: 100%;
  border-radius: var(--radius-sm);
  text-align: start;
}

.employee-body .employee-clue-rephrases .employee-clue-rephrase > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.employee-body .employee-clue-rephrases .employee-clue-rephrase small,
.employee-body .employee-clue-rephrases .employee-clue-rephrase em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.45;
}

.employee-body .employee-clue-rephrases .employee-clue-rephrase strong {
  font-size: 0.9rem;
  line-height: 1.55;
}

.employee-body .employee-clue-equations {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--accent) 36%, var(--border));
}

.employee-body .employee-clue-equations__head {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent-strong);
}

.employee-body .employee-clue-equations__head > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.employee-body .employee-clue-equations__head > div {
  display: grid;
  gap: 2px;
}

.employee-body .employee-clue-equations__head strong {
  font-size: 0.9rem;
}

.employee-body .employee-clue-equations__head span {
  color: var(--muted);
  font-size: 0.78rem;
}

.employee-body .employee-clue-equations__list {
  display: grid;
  gap: 8px;
}

.employee-body .employee-clue-equation-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--card-border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface) 36%);
}

.employee-body .employee-clue-equation-card__preview {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  direction: rtl;
}

.employee-body .employee-clue-equation-card__image {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--surface);
}

.employee-body .employee-clue-equation-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.employee-body .employee-title-suggestions-btn {
  min-height: 46px;
  padding-inline: 14px;
  gap: 7px;
  white-space: nowrap;
  color: var(--accent-strong);
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface) 28%);
}

.employee-body .employee-title-suggestions-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.employee-body .employee-title-quick-tags {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.employee-body .employee-title-quick-tags__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.employee-body .employee-title-quick-tags__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.employee-body .employee-title-quick-tags__hint {
  color: var(--muted);
  font-size: 0.72rem;
}

.employee-body .employee-title-quick-tags__controls {
  display: inline-flex;
  gap: 5px;
  margin-inline-start: auto;
}

.employee-body .employee-title-quick-tags__controls button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  color: var(--accent-strong);
  background: var(--surface);
  cursor: pointer;
}

.employee-body .employee-title-quick-tags__controls button:hover,
.employee-body .employee-title-quick-tags__controls button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.employee-body .employee-title-quick-tags__controls svg {
  width: 16px;
  height: 16px;
}

.employee-body .employee-title-quick-tags__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  max-width: 100%;
  padding: 1px 1px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-border) transparent;
  scroll-snap-type: inline proximity;
}

.employee-body .employee-title-quick-tags__list::-webkit-scrollbar {
  height: 6px;
}

.employee-body .employee-title-quick-tags__list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--accent-border);
}

.employee-body .employee-title-quick-tags__list:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 8px;
}

.employee-body .employee-title-quick-tags__list button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.18s var(--ease-soft), background 0.18s var(--ease-soft), color 0.18s var(--ease-soft), transform 0.18s var(--ease-soft);
}

.employee-body .employee-title-quick-tags__list button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.employee-body .employee-title-quick-tags__list button.is-selected {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.employee-body .employee-title-suggestions-btn svg,
.employee-body .employee-title-suggestions__status svg,
.employee-body .employee-title-suggestion svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.employee-body .employee-title-suggestions-btn[aria-busy="true"] svg,
.employee-body #employeeAiReviewBtn[aria-busy="true"] svg,
.employee-body .employee-title-suggestions__status [data-lucide="loader-circle"] {
  animation: employee-title-suggestions-spin 0.9s linear infinite;
}

.employee-body .employee-title-suggestions {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-soft) 42%, var(--surface) 58%);
}

.employee-body .employee-title-suggestions.is-error {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.employee-body .employee-title-suggestions__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.employee-body .employee-title-suggestions__head strong {
  font-size: 0.9rem;
}

.employee-body .employee-title-suggestions__head span,
.employee-body .employee-title-suggestions__status {
  color: var(--muted);
  font-size: 0.82rem;
}

.employee-body .employee-title-suggestions__status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.employee-body .employee-title-suggestions__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.employee-body .employee-title-suggestion {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.18s var(--ease-soft), background 0.18s var(--ease-soft), transform 0.18s var(--ease-soft);
}

.employee-body .employee-title-suggestion:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.employee-body .employee-title-suggestion.is-selected {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

@keyframes employee-title-suggestions-spin {
  to {
    transform: rotate(360deg);
  }
}

.employee-body .employee-puzzle-assistant {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(71, 85, 105, 0.14);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.employee-body .employee-puzzle-completion-zone.has-puzzle-assistant .puzzle-quality-panel {
  border-radius: 8px 8px 0 0;
}

.employee-body .employee-puzzle-completion-zone .employee-puzzle-assistant > #employeePuzzleCompleteBtn {
  width: 100%;
}

.employee-body .employee-puzzle-assistant__head,
.employee-body .employee-puzzle-assistant__title,
.employee-body .employee-puzzle-assistant__draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.employee-body .employee-puzzle-assistant__title {
  justify-content: flex-start;
}

.employee-body .employee-puzzle-assistant__title > div {
  display: grid;
  gap: 2px;
}

.employee-body .employee-puzzle-assistant__title small,
.employee-body .employee-puzzle-assistant__status {
  color: var(--muted);
  font-size: 0.78rem;
}

.employee-body .employee-puzzle-assistant__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.employee-body .employee-puzzle-assistant__icon svg {
  width: 19px;
  height: 19px;
}

.employee-body .employee-puzzle-assistant__results {
  padding-top: 4px;
}

.employee-body .employee-puzzle-assistant__drafts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.employee-body .employee-puzzle-assistant__draft {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.employee-body .employee-puzzle-assistant__draft-head span {
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.employee-body .employee-puzzle-assistant__draft p,
.employee-body .employee-puzzle-assistant__draft em {
  margin: 0;
  line-height: 1.7;
}

.employee-body .employee-puzzle-assistant__image-guidance {
  display: grid;
  gap: 7px;
}

.employee-body .employee-puzzle-assistant__image-guidance > span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-faint);
  font-size: 0.78rem;
  font-weight: 900;
}

.employee-body .employee-puzzle-assistant__image-guidance small {
  color: var(--muted);
  line-height: 1.55;
}

.employee-body .employee-puzzle-assistant__image-guidance em {
  color: var(--danger);
}

.employee-body .employee-puzzle-assistant__draft small,
.employee-body .employee-puzzle-assistant__draft em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.employee-body .employee-puzzle-assistant__draft .primary-btn {
  width: 100%;
  margin-top: auto;
}

.employee-body .employee-puzzle-assistant__equation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  font-size: 1.35rem;
}

.employee-body .employee-puzzle-assistant__equation b {
  color: var(--accent-strong);
}

.employee-body .employee-puzzle-assistant[data-status="error"] .employee-puzzle-assistant__status {
  color: var(--danger);
}

@media (max-width: 760px) {
  .employee-body .employee-puzzle-assistant__head {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .employee-puzzle-assistant__head > button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .employee-body .employee-title-input-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .employee-body .employee-title-suggestions-btn {
    min-height: 44px;
    padding-inline: 10px;
    font-size: 0.78rem;
  }

  .employee-body .employee-title-suggestions__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body .employee-title-suggestion {
    width: 100%;
    border-radius: var(--radius-sm);
  }

  .employee-body .employee-answer-field-head {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .employee-clue-tools {
    width: 100%;
    justify-content: stretch;
  }

  .employee-body .employee-clue-tools .employee-title-suggestions-btn,
  .employee-body .employee-answer-field-head .employee-answer-suggestions-btn,
  .employee-body .employee-answer-field-head .employee-clue-suggestions-btn {
    width: 100%;
    justify-content: center;
  }

  .employee-body .employee-clue-equation-card {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .employee-clue-equation-card > button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .employee-body .employee-title-suggestions-btn[aria-busy="true"] svg,
  .employee-body #employeeAiReviewBtn[aria-busy="true"] svg,
  .employee-body .employee-title-suggestions__status [data-lucide="loader-circle"] {
    animation: none;
  }
}

/* Contributor management final layout refinements */
.contributor-management-body .management-contribution-card .contribution-card__content {
  grid-template-rows: auto auto minmax(10px, 1fr) auto;
  gap: 8px;
}

.contributor-management-body .management-contribution-card .contribution-card__head,
.contributor-management-body .management-contribution-card .contribution-card__actions {
  display: flex;
}

.contributor-management-body .management-contribution-card .contribution-card__head {
  justify-content: space-between;
  gap: 12px;
}

.contributor-management-body .management-contribution-card .contribution-card__actions > * {
  width: auto;
}

/* Management review workstation: a live repair reference without losing the editor. */
.employee-management-edit-body #employeeNewView .employee-compose-grid {
  grid-template-columns: minmax(420px, 1.22fr) minmax(290px, 0.78fr) minmax(275px, 0.72fr);
  align-items: start;
  gap: 18px;
}

.employee-management-edit-body .employee-management-review-panel {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 28px);
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, #fbfffd 0%, #f6f9ff 100%);
  border: 1px solid #cfe0f5;
  box-shadow: 0 14px 34px rgba(36, 58, 94, 0.08);
}

.employee-management-review-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dce8f4;
}

.employee-management-review-panel__head > div {
  display: grid;
  gap: 2px;
}

.employee-management-review-panel__head strong { color: #213552; font-size: 0.86rem; }
.employee-management-review-panel__head span:not(.employee-management-review-panel__shortcut) { color: #728199; font-size: 0.67rem; }

.employee-management-review-panel__shortcut {
  padding: 5px 8px;
  color: #496582;
  font-size: 0.62rem;
  font-weight: 900;
  background: #edf4fb;
  border: 1px solid #d6e4f2;
  border-radius: 999px;
}

.employee-management-review-panel__content {
  display: grid;
  gap: 11px;
}

.employee-management-live-card,
.employee-management-review-summary,
.employee-management-review-issues,
.employee-management-review-fixes,
.employee-management-review-clear {
  display: grid;
  gap: 8px;
  padding: 11px;
  background: #fff;
  border: 1px solid #dce7f4;
  border-radius: 12px;
}

.employee-management-live-card {
  border-color: #cbddef;
  box-shadow: 0 7px 18px rgba(39, 77, 122, 0.06);
}

.employee-management-live-card__status,
.employee-management-review-issues > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.employee-management-live-card__status span,
.employee-management-review-summary > span,
.employee-management-review-fixes > strong {
  color: #08745c;
  font-size: 0.64rem;
  font-weight: 900;
}

.employee-management-live-card__status strong { color: #254260; font-size: 0.72rem; direction: ltr; }
.employee-management-live-card > strong { color: #253650; font-size: 0.86rem; }
.employee-management-live-card small { color: #718198; font-size: 0.67rem; }
.employee-management-live-card p,
.employee-management-review-summary p,
.employee-management-review-issues p,
.employee-management-review-fixes p { margin: 0; color: #5b6a7f; font-size: 0.72rem; line-height: 1.7; }
.employee-management-live-card .management-icon-action { width: fit-content; margin-top: 1px; }

.employee-management-review-issues { background: #fffaf2; border-color: #efd7ab; }
.employee-management-review-issues > div > strong { color: #6f4a10; font-size: 0.73rem; }
.employee-management-review-issues > div > span { display: grid; width: 22px; height: 22px; place-items: center; color: #8a5a0a; font-size: 0.64rem; font-weight: 900; background: #fff0c9; border-radius: 50%; }
.employee-management-review-issues article { display: grid; gap: 4px; padding-top: 9px; border-top: 1px solid #f0dfbe; }
.employee-management-review-issues article:first-of-type { padding-top: 0; border-top: 0; }
.employee-management-review-issues b { color: #5e4824; font-size: 0.73rem; }
.employee-management-review-issues em { width: fit-content; padding: 3px 6px; color: #89653b; font-size: 0.61rem; font-style: normal; background: rgba(255,255,255,0.72); border-radius: 6px; }
.employee-management-review-fixes { background: #f2faf6; border-color: #cfe9dd; }
.employee-management-review-fixes p { padding: 7px 8px; background: rgba(255,255,255,0.72); border-radius: 8px; }
.employee-management-review-clear { color: #366075; background: #f4fbf8; border-color: #d6ebe1; font-size: 0.72rem; }
.employee-management-review-clear span { color: #6e8290; font-size: 0.67rem; line-height: 1.55; }

.management-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 36px;
  padding-inline: 9px;
}

.management-icon-action > span[aria-hidden="true"] { font-size: 0.9rem; line-height: 1; }

.management-ai-issue__actions {
  display: flex;
  justify-content: flex-end;
  padding-inline-start: 32px;
}

.management-ai-dismiss-issue-btn {
  color: #77521d;
  background: rgba(255, 255, 255, 0.7);
  border-color: #e6cf9c;
}

.management-ai-review-card__body .management-ai-review-actions {
  position: sticky;
  bottom: -15px;
  z-index: 2;
  padding: 11px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.88), #fff 34%);
}

.management-puzzle-preview-page {
  min-height: 100dvh;
  padding: clamp(16px, 4vw, 42px);
  background: radial-gradient(circle at top right, #e9f2ff, transparent 38%), #f5f8fc;
}

.management-puzzle-preview-shell { width: min(760px, 100%); margin: 0 auto; }
.management-puzzle-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.management-puzzle-preview-head > div { display: grid; gap: 3px; }
.management-puzzle-preview-head span { color: #58708a; font-size: 0.72rem; font-weight: 800; }
.management-puzzle-preview-head h1 { margin: 0; color: #243650; font-size: clamp(1.2rem, 3vw, 1.6rem); }
.management-puzzle-preview-card { display: grid; gap: 18px; min-height: 360px; padding: clamp(18px, 5vw, 42px); background: #fff; border: 1px solid #d7e4f4; border-radius: 22px; box-shadow: 0 18px 48px rgba(31, 57, 92, 0.12); }
.management-puzzle-preview-card__definition { color: #73849a; font-size: 0.82rem; font-weight: 800; }
.management-puzzle-preview-card__stage { display: grid; min-height: 150px; place-items: center; color: #253650; font-size: clamp(1rem, 2.4vw, 1.25rem); line-height: 1.9; text-align: center; }
.management-puzzle-preview-card__stage p { margin: 0; max-width: 600px; }
.management-puzzle-preview-images { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.management-puzzle-preview-images img,
.management-puzzle-preview-image img { display: block; width: auto; height: auto; max-width: min(360px, 100%); max-height: min(320px, 45vh); object-fit: contain; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.management-puzzle-preview-equation { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 13px; font-size: clamp(1.55rem, 4vw, 2rem); line-height: 1; }
.management-puzzle-preview-token,
.management-puzzle-preview-question { display: inline-flex; min-width: 0; min-height: 0; padding: 0; align-items: center; justify-content: center; color: #263c5b; font: inherit; font-weight: 900; background: transparent; border: 0; border-radius: 0; }
.management-puzzle-preview-equation > b { color: #7a8ca4; font-size: 1em; }
.management-puzzle-preview-card__answer { display: grid; gap: 8px; padding-top: 15px; border-top: 1px solid #e2eaf4; }
.management-puzzle-preview-card__answer > span { color: #78889b; font-size: 0.7rem; font-weight: 800; }
.management-puzzle-preview-card__answer > b { color: #08745c; font-size: 1rem; }
.management-puzzle-preview-card__answer > div { display: flex; flex-wrap: wrap; gap: 7px; }
.management-puzzle-preview-card__answer > div > b { padding: 5px 9px; color: #14634f; font-size: 0.76rem; background: #edf9f4; border: 1px solid #d0eadf; border-radius: 999px; }
.management-puzzle-preview-empty { color: #8492a6; font-size: 0.8rem; }

@media (max-width: 1120px) {
  .employee-management-edit-body #employeeNewView .employee-compose-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  }
  .employee-management-edit-body .employee-management-review-panel { grid-column: 1 / -1; position: static; max-height: none; }
  .employee-management-edit-body .employee-management-review-panel__content { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .employee-management-edit-body #employeeNewView .employee-compose-grid { grid-template-columns: minmax(0, 1fr); }
  .employee-management-edit-body .employee-management-review-panel__content { grid-template-columns: minmax(0, 1fr); }
  .employee-management-edit-body .employee-management-review-panel { padding: 12px; }
  .management-ai-issue__actions { padding-inline-start: 0; }
  .management-icon-action__label { display: none; }
  .management-icon-action { min-width: 38px; padding-inline: 8px; }
}

/* Batch AI review: one calm workspace for reviewing a selected group. */
.contributor-management-body .management-ai-review-btn {
  color: #4c3cc4;
  background: #f5f3ff;
  border-color: #cfc8ff;
}

.contributor-management-body .management-ai-review-btn:hover,
.contributor-management-body .management-ai-review-btn:focus-visible {
  color: #3d2eaa;
  background: #ece9ff;
  border-color: #aaa0f5;
}

.management-ai-review-dialog {
  width: min(920px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  color: #172033;
  background: #fff;
  border: 1px solid #cfddf5;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(15, 35, 70, 0.26);
}

.management-ai-review-dialog::backdrop {
  background: rgba(15, 29, 55, 0.48);
  backdrop-filter: blur(5px);
}

.management-ai-review-dialog__shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 15px;
  max-height: min(860px, calc(100vh - 28px));
  padding: 22px;
}

.management-ai-review-loading {
  display: flex;
  min-height: 132px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: right;
  background: linear-gradient(135deg, #f5f3ff, #f2f7ff);
  border: 1px solid #d9d5ff;
  border-radius: 16px;
}

.management-ai-review-loading p,
.management-ai-review-card p {
  margin: 0;
}

.management-ai-review-loading p {
  margin-top: 5px;
  color: #64748b;
  font-size: 0.78rem;
}

.management-ai-review-spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 3px solid #d9d5ff;
  border-top-color: #5b4ad7;
  border-radius: 50%;
  animation: management-ai-spin 0.8s linear infinite;
}

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

.management-ai-review-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.management-ai-review-summary > :is(div, article) {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 13px;
  color: #455873;
  background: #f7f9fd;
  border: 1px solid #dfe7f4;
  border-radius: 13px;
}

.management-ai-review-summary strong {
  font-size: 1.18rem;
}

.management-ai-review-summary .is-ready strong { color: #08745c; }
.management-ai-review-summary :is(.is-warning, .is-changes) strong { color: #b56b05; }
.management-ai-review-summary :is(.is-danger, .is-reject) strong { color: #c13b32; }

.management-ai-review-results {
  display: grid;
  min-height: 0;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline-end: 3px;
}

.management-ai-review-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce5f3;
  border-radius: 15px;
}

.management-ai-review-card--ready { border-inline-start: 4px solid #16a47c; }
.management-ai-review-card--warning,
.management-ai-review-card--changes { border-inline-start: 4px solid #e49a24; }
.management-ai-review-card--danger,
.management-ai-review-card--reject { border-inline-start: 4px solid #e25c52; }

.management-ai-review-card > summary {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  list-style: none;
  cursor: pointer;
  background: #fafcff;
}

.management-ai-review-card > summary::-webkit-details-marker { display: none; }

.management-ai-review-card__identity {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.management-ai-review-card__identity strong {
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.management-ai-review-card__identity small {
  display: block;
  margin-top: 3px;
  color: #7b899d;
  font-size: 0.67rem;
}

.management-ai-review-verdict {
  width: fit-content;
  color: #61718a;
  font-size: 0.68rem;
  font-weight: 900;
}

.management-ai-review-score {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 2px;
  direction: ltr;
  color: #64748b;
}

.management-ai-review-score strong {
  color: #24324a;
  font-size: 1.15rem;
}

.management-ai-review-score span { font-size: 0.68rem; }

.management-ai-review-card__body {
  display: grid;
  gap: 14px;
  padding: 15px;
  border-top: 1px solid #e7edf7;
}

.management-ai-review-card__summary {
  color: #53657f;
  font-size: 0.79rem;
  line-height: 1.65;
}

.management-ai-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.management-ai-check {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  color: #53657f;
  background: #f8fafd;
  border: 1px solid #e0e7f1;
  border-radius: 10px;
}

.management-ai-check b {
  overflow: hidden;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.management-ai-check em {
  flex: 0 0 auto;
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 900;
}

.management-ai-check--pass em { color: #08745c; }
.management-ai-check--warning em { color: #b56b05; }
.management-ai-check--fail em { color: #c13b32; }
.management-ai-check--not_applicable em { color: #8592a6; }

.management-ai-review-section {
  display: grid;
  gap: 8px;
}

.management-ai-review-section > h3 {
  margin: 0;
  color: #293a54;
  font-size: 0.78rem;
}

.management-ai-issue-list,
.management-ai-suggestion-list {
  display: grid;
  gap: 7px;
}

.management-ai-issue,
.management-ai-suggestion {
  padding: 10px 12px;
  background: #fafbfd;
  border: 1px solid #e2e8f1;
  border-radius: 11px;
}

.management-ai-issue {
  border-inline-start: 3px solid #e49a24;
}

.management-ai-issue--error,
.management-ai-issue--critical {
  border-inline-start-color: #e25c52;
}

.management-ai-issue strong,
.management-ai-suggestion strong {
  font-size: 0.76rem;
}

.management-ai-issue p,
.management-ai-suggestion p {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.73rem;
  line-height: 1.55;
}

.management-ai-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.management-ai-suggestion > div { min-width: 0; }

.management-ai-open-edit {
  width: fit-content;
  justify-self: end;
}

.management-ai-review-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 13px;
  border-top: 1px solid #e5ecf6;
}

.management-ai-review-dialog__footer .meta-note {
  color: #75859b;
  font-size: 0.7rem;
}

.management-ai-review-error {
  padding: 20px;
  color: #a92f27;
  background: #fff5f4;
  border: 1px solid #f2c4c0;
  border-radius: 13px;
}

@media (max-width: 700px) {
  .management-ai-review-dialog__shell { padding: 15px; }
  .management-ai-review-summary { grid-template-columns: minmax(0, 1fr); }
  .management-ai-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .management-ai-review-dialog__footer {
    align-items: stretch;
    flex-direction: column;
  }
  .management-ai-review-dialog__footer .button-row,
  .management-ai-review-dialog__footer .button-row > * { width: 100%; }
}

@media (max-width: 430px) {
  .management-ai-checks { grid-template-columns: minmax(0, 1fr); }
  .management-ai-suggestion { align-items: stretch; flex-direction: column; }
  .management-ai-suggestion button { width: 100%; }
}

/* AI review UX: preserve expanded content height and make actions scannable. */
.management-ai-review-dialog {
  width: min(980px, calc(100vw - 28px));
}

.management-ai-review-dialog__shell {
  min-height: min(720px, calc(100dvh - 28px));
  overflow: hidden;
}

.management-ai-review-summary > :is(div, article) {
  min-height: 54px;
  padding: 9px 14px;
  font-weight: 800;
}

.management-ai-review-summary .is-ready {
  color: #176c58;
  background: #f0faf6;
  border-color: #c7eadc;
}

.management-ai-review-summary .is-changes {
  color: #8b5b12;
  background: #fff9ec;
  border-color: #f1dba9;
}

.management-ai-review-summary .is-reject {
  color: #9b312c;
  background: #fff4f3;
  border-color: #f1c6c2;
}

.management-ai-review-results {
  display: block;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  background: #f5f8fc;
  border: 1px solid #e0e8f3;
  border-radius: 16px;
  scrollbar-gutter: stable;
}

.management-ai-review-group {
  display: grid;
  gap: 9px;
}

.management-ai-review-group + .management-ai-review-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #dce5f1;
}

.management-ai-review-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-inline: 3px;
}

.management-ai-review-group__head > div {
  display: grid;
  gap: 2px;
}

.management-ai-review-group__head strong {
  color: #26364e;
  font-size: 0.82rem;
}

.management-ai-review-group__head span {
  color: #7b899c;
  font-size: 0.68rem;
}

.management-ai-review-group__head > b {
  display: grid;
  min-width: 27px;
  height: 27px;
  padding-inline: 6px;
  place-items: center;
  color: #9a5d08;
  font-size: 0.76rem;
  background: #fff2cf;
  border-radius: 999px;
}

.management-ai-review-group--ready .management-ai-review-group__head > b {
  color: #0c735a;
  background: #dff5ec;
}

.management-ai-review-group__cards {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 9px;
}

.management-ai-review-card {
  min-height: 0;
  flex: none;
  overflow: clip;
  background: #fff;
  box-shadow: 0 3px 12px rgba(31, 52, 87, 0.035);
}

.management-ai-review-card[open] {
  box-shadow: 0 9px 24px rgba(31, 52, 87, 0.08);
}

.management-ai-review-card > summary {
  position: relative;
  min-height: 76px;
  padding: 12px 14px;
  background: #fff;
}

.management-ai-review-card[open] > summary {
  background: linear-gradient(180deg, #fbfdff, #f7faff);
}

/* Dense scan mode: a batch can be reviewed from the summaries, while the
   full explanatory content remains one click away. */
.management-ai-review-card > summary {
  min-height: 60px;
  padding-block: 9px;
}

.management-ai-review-card__identity {
  gap: 2px;
}

.management-ai-review-card__identity small {
  margin-top: 0;
  font-size: 0.68rem;
}

.management-ai-review-card__body {
  gap: 10px;
  padding: 12px 14px;
}

.management-ai-checks--compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.management-ai-checks--compact .management-ai-check {
  display: inline-flex;
  grid-template-columns: none;
  width: auto;
  min-height: 0;
  gap: 6px;
  padding: 5px 8px;
}

.management-ai-review-card__identity {
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
}

.management-ai-review-card__identity strong {
  color: #18243a;
  font-size: 0.98rem;
}

.management-ai-review-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.management-ai-review-verdict i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #e49a24;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(228, 154, 36, 0.13);
}

.management-ai-review-card--ready .management-ai-review-verdict i {
  background: #16a47c;
  box-shadow: 0 0 0 3px rgba(22, 164, 124, 0.12);
}

.management-ai-review-card--reject .management-ai-review-verdict i {
  background: #e25c52;
  box-shadow: 0 0 0 3px rgba(226, 92, 82, 0.12);
}

.management-ai-review-card__result-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

.management-ai-review-counts {
  color: #75849a;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.management-ai-review-score {
  min-width: 59px;
  justify-content: center;
  padding: 7px 8px;
  background: #f1f5fb;
  border-radius: 10px;
}

.management-ai-review-chevron {
  width: 9px;
  height: 9px;
  margin-inline: 3px 2px;
  border-inline-end: 2px solid #718098;
  border-bottom: 2px solid #718098;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.management-ai-review-card[open] .management-ai-review-chevron {
  transform: rotate(225deg);
}

.management-ai-review-card__body {
  gap: 16px;
  padding: 16px;
  background: #fff;
}

.management-ai-review-card__body {
  gap: 10px;
  padding: 12px 14px;
}

.management-ai-review-overview {
  display: grid;
  gap: 5px;
  padding: 11px 13px;
  color: #4e6078;
  background: #f6f8fc;
  border: 1px solid #e2e8f2;
  border-radius: 11px;
}

.management-ai-review-overview > span {
  color: #7c8a9e;
  font-size: 0.65rem;
  font-weight: 900;
}

.management-ai-review-applied-note {
  padding: 10px 12px;
  color: #0f6f58;
  font-size: 0.74rem;
  font-weight: 800;
  background: #ecfbf5;
  border: 1px solid #ccefe0;
  border-radius: 10px;
}

.management-ai-review-taxonomy {
  margin-top: 2px;
}

.management-ai-taxonomy-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 9px;
  padding: 10px;
  background: #fbfcff;
  border: 1px solid #dde7f4;
  border-radius: 10px;
}

.management-ai-taxonomy-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.management-ai-taxonomy-field > span {
  color: #607189;
  font-size: 0.65rem;
  font-weight: 900;
}

.management-ai-taxonomy-field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: #1b2c45;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  background: #fff;
  border: 1px solid #cbd9ea;
  border-radius: 8px;
  outline: none;
}

.management-ai-taxonomy-field select:focus-visible {
  border-color: #5b7cf5;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.12);
}

.management-topic-picker {
  position: relative;
  min-width: 0;
}

.management-topic-picker__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  overflow: hidden;
  min-height: 38px;
  color: #1b2c45;
  background: #fff;
  border: 1px solid #cbd9ea;
  border-radius: 8px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.management-topic-picker:focus-within .management-topic-picker__control {
  border-color: #5b7cf5;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.12);
}

.management-topic-picker__search {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: inherit;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  outline: 0;
}

.management-topic-picker__search::placeholder {
  color: #8a99ad;
  font-weight: 700;
}

.management-topic-picker__toggle {
  display: grid;
  place-items: center;
  padding: 0;
  color: #526783;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  background: #f6f9fd;
  border: 0;
  border-inline-start: 1px solid #d9e3f0;
  cursor: pointer;
}

.management-topic-picker__toggle:hover {
  color: #315cf4;
  background: #edf3ff;
}

.management-topic-picker__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 248px;
  padding: 5px;
  overflow: auto;
  background: #fff;
  border: 1px solid #cbd9ea;
  border-radius: 9px;
  box-shadow: 0 14px 28px rgba(31, 55, 91, 0.16);
}

.management-topic-picker__option {
  width: 100%;
  padding: 8px 10px;
  color: #31445f;
  text-align: right;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.management-topic-picker__option:hover,
.management-topic-picker__option:focus-visible,
.management-topic-picker__option.is-selected {
  color: #2446c9;
  background: #edf3ff;
  outline: 0;
}

.management-topic-picker__empty {
  margin: 0;
  padding: 10px;
  color: #75849a;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.management-ai-taxonomy-field small {
  min-height: 15px;
  color: #7d8ba0;
  font-size: 0.62rem;
  line-height: 1.45;
}

.management-ai-taxonomy-save {
  min-height: 38px;
  white-space: nowrap;
}

.management-ai-puzzle-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.management-ai-puzzle-details article {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 9px 10px;
  background: #f8fbff;
  border: 1px solid #e1eaf5;
  border-radius: 10px;
}

.management-ai-puzzle-details article.is-wide {
  grid-column: 1 / -1;
}

.management-ai-puzzle-details span {
  color: #75849a;
  font-size: 0.64rem;
  font-weight: 900;
}

.management-ai-puzzle-details strong {
  min-width: 0;
  color: #26364e;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.management-ai-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.management-ai-word-list span {
  padding: 4px 8px;
  color: #17335c;
  background: #eef4ff;
  border: 1px solid #d6e3fb;
  border-radius: 999px;
}

.management-ai-puzzle-preview {
  display: grid;
  min-height: 78px;
  place-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid #e0e8f3;
  border-radius: 10px;
}

.management-ai-review-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.management-ai-review-section__head h3 {
  margin: 0;
  color: #253650;
  font-size: 0.8rem;
}

.management-ai-review-section__head > span {
  display: grid;
  min-width: 24px;
  height: 24px;
  padding-inline: 6px;
  place-items: center;
  color: #68778d;
  font-size: 0.65rem;
  font-weight: 900;
  background: #edf2f8;
  border-radius: 999px;
}

.management-ai-check {
  min-height: 39px;
  padding: 8px 9px;
}

.management-ai-check--pass {
  background: #f3faf7;
  border-color: #d6ede4;
}

.management-ai-check--warning {
  background: #fff9ee;
  border-color: #f1dfb9;
}

.management-ai-check--fail {
  background: #fff4f3;
  border-color: #f1cfcb;
}

.management-ai-check--not_applicable {
  opacity: 0.66;
}

.management-ai-issue {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: #fffaf1;
  border-color: #f0d9ae;
  border-inline-start-width: 4px;
}

.management-ai-issue--error,
.management-ai-issue--critical {
  background: #fff6f5;
  border-color: #efccc8;
}

.management-ai-issue__head {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.management-ai-issue__number,
.management-ai-suggestion__number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #9a5d08;
  font-size: 0.68rem;
  font-weight: 900;
  background: #fff0c7;
  border-radius: 50%;
}

.management-ai-issue--error .management-ai-issue__number,
.management-ai-issue--critical .management-ai-issue__number {
  color: #a8342e;
  background: #ffe0dd;
}

.management-ai-issue__head > em {
  padding: 4px 7px;
  color: #806442;
  font-size: 0.63rem;
  font-style: normal;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 7px;
}

.management-ai-issue > p {
  padding-inline-start: 32px;
  color: #5b6575;
  font-size: 0.76rem;
}

.management-ai-suggestion {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f3faf7;
  border-color: #d2eadd;
}

.management-ai-suggestion__number {
  color: #08745c;
  background: #d9f3e9;
}

.management-ai-suggestion > div {
  display: grid;
  gap: 3px;
}

.management-ai-suggestion > div > span {
  width: fit-content;
  color: #08745c;
  font-size: 0.62rem;
  font-weight: 900;
}

.management-ai-suggestion__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.management-ai-suggestion__actions button {
  white-space: nowrap;
}

.management-ai-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e4ebf4;
}

.management-ai-review-actions > span {
  color: #74839a;
  font-size: 0.68rem;
}

.management-ai-open-edit {
  min-height: 38px;
  color: #fff;
}

@media (max-width: 760px) {
  .management-ai-review-dialog__shell {
    min-height: calc(100dvh - 20px);
  }

  .management-ai-review-card > summary {
    align-items: flex-start;
  }

  .management-ai-review-card__result-meta {
    gap: 7px;
  }

  .management-ai-review-counts {
    display: none;
  }

  .management-ai-taxonomy-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management-ai-taxonomy-save {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .management-ai-review-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .management-ai-review-dialog__shell {
    max-height: calc(100dvh - 12px);
    min-height: calc(100dvh - 12px);
    padding: 12px;
  }

  .management-ai-review-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .management-ai-review-summary > :is(div, article) {
    display: grid;
    min-height: 54px;
    justify-content: center;
    gap: 1px;
    padding: 6px;
    text-align: center;
  }

  .management-ai-review-summary span {
    font-size: 0.61rem;
  }

  .management-ai-review-card__result-meta {
    align-self: center;
  }

  .management-ai-review-score {
    min-width: 50px;
    padding: 6px;
  }

  .management-ai-review-card__body {
    padding: 12px;
  }

  .management-ai-puzzle-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .management-ai-taxonomy-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .management-ai-issue__head {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .management-ai-issue__head > em {
    grid-column: 2;
    width: fit-content;
  }

  .management-ai-issue > p {
    padding-inline-start: 0;
  }

  .management-ai-suggestion {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .management-ai-suggestion__actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: stretch;
  }

  .management-ai-suggestion__actions button {
    flex: 1 1 145px;
    width: 100%;
  }

  .management-ai-review-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .management-ai-review-actions .button-row {
    width: 100%;
  }

  .management-ai-review-actions .button-row > * {
    flex: 1 1 150px;
  }

  .management-ai-review-actions .management-ai-open-edit {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .contributor-management-body .management-results-toolbar__summary {
    gap: 8px;
  }

  .contributor-management-body .management-results-toolbar__summary .contributions-results-count {
    width: 100%;
  }

  .contributor-management-body .management-results-toolbar__controls {
    width: 100%;
    justify-content: flex-start;
  }

  .contributor-management-body .management-select-page {
    align-self: flex-start;
  }

  .contributor-management-body .management-bulk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .contributor-management-body .management-card-actions-row {
    gap: 10px;
  }

  .contributor-management-body .management-contribution-card .contribution-card__actions {
    display: flex;
    grid-template-columns: none;
    flex-wrap: wrap;
  }

  .contributor-management-body .management-history-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .contributor-management-body .management-history-item time {
    grid-column: 2;
  }
}

/* Contributor management — contributions tab */
.contributor-management-main-tabs {
  grid-template-columns: minmax(180px, 1fr);
}

.contributor-management-contributions-view > .panel {
  overflow: visible;
}

.contributor-management-panel-head {
  align-items: flex-end;
}

.contributor-management-panel-head h2 {
  margin: 10px 0 4px;
}

.management-section-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 7px;
  background: #edf3ff;
  border: 1px solid #d7e3f8;
  border-radius: 18px;
}

.management-section-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 16px;
  color: #526581;
  font-family: inherit;
  font-weight: 800;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  transition: 160ms ease;
}

.management-section-tab strong {
  display: grid;
  min-width: 28px;
  height: 28px;
  padding-inline: 6px;
  place-items: center;
  color: #31547f;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.74);
  border-radius: 999px;
}

.management-section-tab:hover,
.management-section-tab:focus-visible {
  color: #1d4ed8;
  background: rgba(255, 255, 255, 0.65);
}

.management-section-tab.active {
  color: #17335c;
  background: #fff;
  border-color: #c9d9f4;
  box-shadow: 0 7px 18px rgba(49, 84, 127, 0.12);
}

.management-section-tab.active strong {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.management-results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block: 12px;
}

.management-results-toolbar__summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.management-results-toolbar__controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.management-page-size-control {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: #526581;
  background: #f8faff;
  border: 1px solid #d7e3f8;
  border-radius: 11px;
}

.management-page-size-control span {
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.management-page-size-control select {
  min-width: 70px;
  color: #172033;
  font: inherit;
  font-weight: 800;
  background: #fff;
  border: 1px solid #cbd8ee;
  border-radius: 8px;
}

.management-filter-btn {
  gap: 7px;
  min-width: 92px;
}

.management-filter-btn svg,
.management-refresh-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.management-refresh-btn {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
}

.management-refresh-btn span {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}

.management-filter-btn.is-active {
  color: #1d4ed8;
  border-color: #93b4ef;
  background: #edf4ff;
}

.management-filter-btn strong {
  display: grid;
  min-width: 21px;
  height: 21px;
  padding-inline: 5px;
  place-items: center;
  color: #fff;
  font-size: 0.7rem;
  background: #315cf4;
  border-radius: 999px;
}

.management-page-status {
  margin: 0 0 12px;
  padding: 8px 12px;
}

.management-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 14px;
  padding: 10px 12px;
  color: #17335c;
  background: linear-gradient(135deg, #edf4ff, #f5f1ff);
  border: 1px solid #bfd1f2;
  border-radius: 13px;
}

.management-select-page,
.management-card-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.management-select-page {
  min-height: 42px;
  padding: 7px 11px;
  color: #526581;
  background: #f8faff;
  border: 1px solid #d7e3f8;
  border-radius: 11px;
}

.management-select-page input,
.management-card-select input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #315cf4;
}

.management-bulk-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.management-bulk-toolbar > span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.management-contribution-card {
  position: relative;
  overflow: hidden;
}

.management-contribution-card.is-selected {
  border-color: #7698f5;
  box-shadow: 0 10px 26px rgba(49, 92, 244, 0.13);
}

.management-card-select {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  background: transparent;
  border-radius: 9px;
}

.management-card-select input {
  width: 18px;
  height: 18px;
}

.management-compact-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.management-compact-alert {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: #8a5b10;
  font-size: 0.69rem;
  font-weight: 800;
  background: #fff8e8;
  border: 1px solid #f1d39a;
  border-radius: 999px;
}

.management-compact-alert b {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.68);
  border-radius: 50%;
}

.management-compact-alert--danger {
  color: #b42318;
  background: #fff1f0;
  border-color: #f7b3ad;
}

.management-compact-alert--info {
  color: #2257a5;
  background: #edf5ff;
  border-color: #bfd5f5;
}

.management-filter-dialog {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  color: #172033;
  background: #fff;
  border: 1px solid #cfddf5;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(15, 35, 70, 0.23);
}

.management-filter-dialog::backdrop {
  background: rgba(15, 29, 55, 0.42);
  backdrop-filter: blur(4px);
}

.management-filter-dialog__shell {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.management-filter-dialog__head,
.management-filter-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.management-filter-dialog__head h2,
.management-filter-dialog__head p {
  margin: 0;
}

.management-filter-dialog__head h2 {
  font-size: 1.12rem;
}

.management-filter-dialog__head p {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.78rem;
}

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

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

.management-filter-field {
  display: grid;
  gap: 7px;
}

.management-filter-field > span {
  color: #455873;
  font-size: 0.78rem;
  font-weight: 800;
}

.management-filter-field input,
.management-filter-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: #172033;
  font: inherit;
  background: #f8faff;
  border: 1px solid #c9d8ef;
  border-radius: 11px;
  outline: none;
}

.management-filter-field input:focus-visible,
.management-filter-field select:focus-visible {
  border-color: #5b7cf5;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.12);
}

.management-card-actions-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
}

.management-card-owner-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: #7c8da3;
  font-size: 0.72rem;
  white-space: nowrap;
}

.management-card-owner-meta span::before {
  content: "•";
  margin-inline-end: 7px;
  color: #b1bfd2;
}

.management-card-author {
  flex: 0 1 auto;
  color: #64748b;
  direction: ltr;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: left;
}

.management-taxonomy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.management-card-taxonomy {
  margin-block: 2px 10px;
}

.management-card-taxonomy-editor {
  grid-template-columns: repeat(2, minmax(0, 180px)) auto;
  align-items: end;
  justify-content: start;
  max-width: 540px;
  padding: 8px;
  margin-block: -2px 10px;
}

.management-card-taxonomy-editor .management-ai-taxonomy-field select {
  min-height: 34px;
  padding-block: 6px;
  font-size: 0.72rem;
}

.management-card-taxonomy-editor .management-topic-picker__control {
  min-height: 34px;
}

.management-card-taxonomy-editor .management-topic-picker__search {
  padding-block: 6px;
  font-size: 0.72rem;
}

.management-ai-taxonomy-classify {
  white-space: nowrap;
}

.management-ai-taxonomy-editor.is-saving {
  opacity: 0.72;
  pointer-events: none;
}

.management-taxonomy-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: #25364f;
  font-size: 0.68rem;
  font-weight: 900;
  background: #f5f8fc;
  border: 1px solid #dce6f3;
  border-radius: 999px;
  line-height: 1.25;
  white-space: nowrap;
}

.management-taxonomy-chip b {
  color: #75849a;
  font-size: 0.6rem;
}

.management-taxonomy-chip--difficulty {
  color: #16406f;
  background: #edf6ff;
  border-color: #cfe3fb;
}

.management-taxonomy-chip--topic {
  color: #17604d;
  background: #edf9f4;
  border-color: #cbeedf;
}

.contribution-taxonomy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.contribution-taxonomy-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  color: #25364f;
  font-size: 0.68rem;
  font-weight: 900;
  background: #f5f8fc;
  border: 1px solid #dce6f3;
  border-radius: 999px;
  line-height: 1.25;
  white-space: nowrap;
}

.contribution-taxonomy-chip b {
  color: #75849a;
  font-size: 0.6rem;
}

.contribution-taxonomy-chip--difficulty {
  color: #16406f;
  background: #edf6ff;
  border-color: #cfe3fb;
}

.contribution-taxonomy-chip--topic {
  color: #17604d;
  background: #edf9f4;
  border-color: #cbeedf;
}

.card-bank-taxonomy-chips {
  margin-block: -2px 2px;
}

.management-history-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  color: #172033;
  background: #fff;
  border: 1px solid #cfddf5;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(15, 35, 70, 0.23);
}

.management-history-dialog::backdrop {
  background: rgba(15, 29, 55, 0.42);
  backdrop-filter: blur(4px);
}

.management-history-dialog__shell {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.management-history-list {
  display: grid;
  max-height: min(540px, calc(100vh - 190px));
  overflow-y: auto;
}

.management-history-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid #e5edf9;
}

.management-history-item:last-child {
  border-bottom: 0;
}

.management-history-item__icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #315cf4;
  font-weight: 900;
  background: #edf3ff;
  border-radius: 50%;
}

.management-history-item__content {
  display: grid;
  gap: 3px;
}

.management-history-item__content strong {
  font-size: 0.88rem;
}

.management-history-item__content p,
.management-history-item__content small {
  margin: 0;
  color: #64748b;
  font-size: 0.75rem;
}

.management-history-item__content b {
  color: #334155;
}

.management-history-item time {
  color: #7c8da3;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.management-approve-btn {
  color: #fff;
  background: linear-gradient(135deg, #059669, #0f766e);
  border-color: transparent;
  box-shadow: 0 7px 15px rgba(5, 150, 105, 0.18);
}

.management-approve-btn:hover,
.management-approve-btn:focus-visible {
  background: linear-gradient(135deg, #047857, #115e59);
}

.management-pagination {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .management-results-toolbar,
  .contributor-management-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .management-results-toolbar .status-box {
    width: 100%;
  }

  .management-results-toolbar__summary,
  .management-bulk-toolbar,
  .management-bulk-toolbar__actions {
    width: 100%;
  }

  .management-bulk-toolbar__actions {
    justify-content: space-between;
  }

  .management-card-actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .management-card-owner-meta {
    width: 100%;
    justify-content: flex-start;
  }

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

  .management-filter-field--wide {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .management-section-tabs {
    gap: 6px;
    padding: 5px;
  }

  .management-section-tab {
    gap: 5px;
    min-height: 44px;
    padding: 8px;
    font-size: 0.78rem;
  }

  .management-section-tab strong {
    min-width: 24px;
    height: 24px;
  }
}

/* Senior contributor access and management foundation */
.employee-body .portal-topbar .contributor-management-btn {
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #047857, #0f766e);
  border-color: rgba(255, 255, 255, 0.22);
}

.contributor-management-notification-badge {
  position: absolute;
  inset-block-start: -8px;
  inset-inline-start: -8px;
  display: grid;
  min-width: 23px;
  height: 23px;
  padding-inline: 5px;
  place-items: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  background: #dc2626;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 5px 12px rgba(185, 28, 28, 0.34);
  pointer-events: none;
}

.employee-body .portal-topbar .contributor-management-btn:hover,
.employee-body .portal-topbar .contributor-management-btn:focus-visible {
  background: linear-gradient(135deg, #065f46, #115e59);
}

.admin-user-role-field {
  margin-block: 12px;
}

.admin-user-role-field .button-row {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  border: 0;
}

.admin-user-role-field select {
  min-width: 150px;
}

.contributor-management-layout {
  gap: 22px;
}

.contributor-management-welcome {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: clamp(22px, 4vw, 40px);
  border-color: rgba(5, 150, 105, 0.24);
  background:
    radial-gradient(circle at 12% 20%, rgba(16, 185, 129, 0.12), transparent 28%),
    #fff;
}

.contributor-management-welcome__icon {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  place-items: center;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #059669, #0f766e);
  border-radius: 20px;
  box-shadow: 0 14px 30px rgba(5, 150, 105, 0.22);
}

.contributor-management-welcome h2 {
  margin: 10px 0 6px;
}

.contributor-management-welcome p,
.contributor-management-placeholder p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.contributor-management-role {
  color: #065f46;
  background: #d1fae5;
}

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

.contributor-management-placeholder .panel {
  min-height: 170px;
  padding: 24px;
}

.contributor-management-placeholder h3 {
  margin: 12px 0 8px;
}

.contributor-management-step {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 800;
}

.contributor-management-next {
  border-style: dashed;
}

.contributor-management-back {
  text-decoration: none;
}

@media (max-width: 700px) {
  .contributor-management-placeholder {
    grid-template-columns: minmax(0, 1fr);
  }

  .contributor-management-welcome {
    align-items: flex-start;
  }

  .contributor-management-welcome__icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    border-radius: 16px;
  }
}

/* ── Storage picker status ───────────────────────── */
#storagePickerStatus.status-ok  { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
#storagePickerStatus.status-err { background: var(--danger-soft);  border-color: var(--danger-border);  color: var(--danger); }

/* ── Auth / collaboration portal ─────────────────── */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #f8fafc, #eef6f7);
  background-size: 34px 34px, 34px 34px, auto;
}

.auth-shell {
  width: min(460px, 100%);
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: surface-enter 0.34s var(--ease-out) both;
}

.auth-card h1 {
  margin: 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.portal-layout label {
  display: grid;
  gap: 6px;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
}

.auth-form input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.portal-layout {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: clamp(14px, 2vw, 24px);
}

.portal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: surface-enter 0.34s var(--ease-out) both;
}

.portal-topbar h1 {
  margin: 0;
}

.portal-grid,
.approved-hints-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.portal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--nav-bg);
  box-shadow: var(--shadow-soft);
}

.portal-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 800;
  transition:
    background-color 0.2s var(--ease-soft),
    border-color 0.2s var(--ease-soft),
    color 0.2s var(--ease-soft);
}

.portal-tab.active {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--accent-border);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.employee-compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  gap: 16px;
  align-items: start;
  width: 100%;
}

.employee-form-panel {
  min-width: 0;
}

.employee-preview-panel {
  position: sticky;
  top: 18px;
}

.employee-form-panel .wide {
  grid-column: 1 / -1;
}

.employee-items-list {
  display: grid;
  gap: 10px;
}

.employee-items-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.employee-item-row {
  display: grid;
  grid-template-columns: auto 132px minmax(0, 1fr) repeat(4, auto);
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  transition:
    border-color 0.2s var(--ease-soft),
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-soft);
}

.employee-item-row:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.employee-item-row.dragging {
  opacity: 0.55;
}

.employee-item-row.drag-over {
  outline: 2px solid var(--accent-border);
}

.drag-handle {
  cursor: grab;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.employee-item-row input[readonly] {
  color: var(--muted);
}

.employee-item-row input[data-emoji-trigger] {
  cursor: pointer;
}

.employee-item-image-value {
  position: relative;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 12px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font: inherit;
  cursor: pointer;
}

.employee-item-image-value.has-image {
  padding-inline-end: 76px;
  cursor: default;
}

.employee-item-image-value .image-chip-preview {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.employee-item-image-value img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-item-image-value.is-empty {
  justify-content: flex-start;
  font-size: 0.88rem;
}

.employee-item-image-actions {
  position: absolute;
  inset-block: 50% auto;
  inset-inline-end: 8px;
  display: inline-flex;
  gap: 6px;
  transform: translateY(-50%);
}

.employee-item-image-actions .icon-mini-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: #1f2937;
  background: #ffffff;
}

.employee-item-image-actions .icon-mini-btn svg,
.employee-item-image-actions .icon-mini-btn i {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.employee-item-image-actions .icon-mini-btn span {
  display: inline-grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.employee-item-image-actions .icon-mini-btn.danger-btn {
  color: var(--danger);
}

.employee-item-image-value.is-dragover {
  border-color: rgba(37, 99, 235, 0.78);
  background: rgba(239, 246, 255, 0.78);
  box-shadow: var(--focus-ring);
}

.employee-item-row .image-sources-btn {
  gap: 6px;
  white-space: nowrap;
}

.employee-item-row .image-sources-btn svg,
.employee-item-row .image-sources-btn i {
  position: static;
  inset: auto;
  transform: none;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
}

.emoji-picker button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  cursor: pointer;
}

.emoji-dialog emoji-picker {
  width: min(420px, 86vw);
  height: 440px;
}

.employee-live-preview {
  min-height: 260px;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, var(--surface-3), var(--surface-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.employee-preview-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
  font-weight: 800;
  font-size: 1.1rem;
}

.employee-preview-words {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
}

.employee-preview-words > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.employee-preview-words span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--input-bg);
  font-weight: 800;
}

.preview-text {
  white-space: pre-wrap;
  font-size: 1.05rem;
}

.preview-image {
  display: grid;
  gap: 8px;
}

button.preview-image,
button.preview-item.image-item,
.image-chip-preview {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.preview-image-grid,
.employee-image-list {
  display: flex;
  gap: 10px;
}

.preview-image-grid {
  align-items: start;
  overflow-x: auto;
  padding-bottom: 4px;
}

.employee-image-list {
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.employee-image-control-row {
  display: flex;
  align-items: flex-start;
  flex-direction: row;
  justify-content: space-between;
  gap: 14px;
  direction: rtl;
}

#employeeImageEditor.field-block {
  padding: 14px;
}

.employee-image-preview-panel {
  display: grid;
  align-self: flex-start;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  border-radius: var(--radius-sm);
  transition:
    outline-color 0.16s var(--ease-soft),
    background-color 0.16s var(--ease-soft);
}

.employee-image-preview-panel label {
  text-align: right;
}

.employee-image-preview-panel.is-dragover {
  outline: 2px dashed rgba(37, 99, 235, 0.58);
  outline-offset: 6px;
  background: rgba(239, 246, 255, 0.42);
}

.employee-image-preview-panel > .meta-note:empty {
  display: none;
}

.employee-image-preview-panel > .employee-image-list {
  margin-bottom: 0;
  padding-bottom: 0;
}

.employee-image-preview-panel > #employeeRemoveImageBtn {
  justify-self: start;
  gap: 6px;
  margin-top: 8px;
}

.employee-image-preview-panel > #employeeRemoveImageBtn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.employee-image-empty {
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.7;
}

.preview-image img {
  width: auto;
  height: auto;
  max-width: min(100%, 240px);
  max-height: 220px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  box-shadow: var(--shadow-soft);
}

.preview-image.compact img {
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 72px;
}

.employee-image-chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  cursor: grab;
  transition:
    border-color 0.2s var(--ease-soft),
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-soft);
}

.employee-image-chip img {
  width: auto;
  height: auto;
  max-width: 160px;
  max-height: 110px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--panel-bg);
}

.employee-image-chip .image-chip-preview {
  display: inline-grid;
  place-items: center;
}

.employee-image-chip .icon-mini-btn,
.employee-image-chip .image-drag-handle {
  position: absolute;
  z-index: 2;
}

.employee-image-chip .image-drag-handle {
  top: 6px;
  inset-inline-start: 6px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: color-mix(in srgb, var(--panel-bg) 84%, transparent);
  cursor: grab;
}

.employee-image-chip .icon-mini-btn {
  top: 6px;
  inset-inline-end: 6px;
  background: color-mix(in srgb, var(--panel-bg) 84%, transparent);
}

.employee-image-chip.dragging {
  opacity: 0.72;
  transform: scale(0.98);
}

.employee-image-chip.drag-over {
  border-color: var(--accent);
  box-shadow: var(--focus-ring), var(--shadow-soft);
}

.image-action-stack {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(90px, auto) repeat(2, minmax(34px, auto));
  align-self: flex-start;
  align-content: start;
  gap: 14px;
  margin-top: 28px;
  min-height: 0;
  width: min(300px, 100%);
}

.image-action-stack > button {
  position: relative;
  height: 100%;
  min-height: 0;
  width: 100%;
  justify-content: center;
  padding-inline: 38px 12px;
  white-space: nowrap;
}

.image-upload-btn,
.ai-image-btn,
.image-assistant-btn,
.image-sources-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 900;
}

.employee-image-assistant {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.employee-image-assistant--dialog {
  padding: 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-faint) 32%, var(--surface) 68%);
}

.employee-image-assistant--dialog > .image-assistant-btn {
  width: 100%;
  justify-content: center;
}

.ai-image-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ai-image-context > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 900;
}

.ai-image-context > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-image-context b {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.85rem;
}

.employee-image-assistant__status {
  padding: 8px 11px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 800;
}

.employee-image-assistant__status.is-warning {
  border-color: var(--warning-border);
  color: var(--warning-text);
  background: var(--warning-soft);
}

.employee-image-assistant__status.is-error {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-soft);
}

.employee-image-assistant__results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 8px;
}

.employee-image-assistant__card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--card-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-faint) 48%, var(--surface) 52%);
}

.employee-image-assistant__card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.employee-image-assistant__badges {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.employee-image-assistant__badges span,
.employee-image-assistant__best {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent-faint) 82%, var(--surface) 18%);
  font-size: 0.78rem;
  font-weight: 900;
}

.employee-image-assistant__card p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
  text-align: start;
}

.employee-image-assistant__card .primary-btn {
  width: 100%;
  min-height: 34px;
  padding-block: 6px;
  margin-top: auto;
}

.secondary-btn.image-upload-btn {
  min-height: 90px;
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.72);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.secondary-btn.image-upload-btn:hover,
.secondary-btn.image-upload-btn:focus-visible {
  color: #1d4ed8;
  border-color: #2563eb;
  background: rgba(239, 246, 255, 0.96);
}

.ai-image-btn {
  min-width: 54px;
}

.image-sources-btn {
  min-width: 116px;
}

.image-upload-btn i,
.image-upload-btn svg,
.ai-image-btn i,
.ai-image-btn svg,
.image-sources-btn i,
.image-sources-btn svg {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  transform: translateY(-50%);
}

.image-sources-dialog {
  width: min(940px, calc(100vw - 28px));
}

.image-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.image-source-card {
  display: grid;
  gap: 7px;
  min-height: 128px;
  padding: 13px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-soft);
  transition:
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    transform 0.15s var(--ease-out);
}

.image-source-card:hover,
.image-source-card:focus-visible {
  border-color: var(--accent-border);
  box-shadow: var(--focus-ring), var(--shadow-soft);
  transform: translateY(-1px);
  outline: none;
}

.image-source-category {
  justify-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  color: #155e75;
  background: rgba(236, 254, 255, 0.86);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.5;
}

.image-source-card strong {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.35;
}

.image-source-card small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.65;
}

.image-source-note {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 119, 6, 0.24);
  border-radius: var(--radius-sm);
  color: #92400e;
  background: rgba(254, 243, 199, 0.72);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.7;
}

@media (max-width: 620px) {
  .employee-image-control-row {
    flex-direction: column;
  }

  .employee-image-preview-panel {
    width: 100%;
  }

  .image-action-stack {
    width: 100%;
  }

  .image-source-grid {
    grid-template-columns: 1fr;
  }
}

.employee-ai-image-dialog {
  width: min(900px, calc(100vw - 28px));
}

.ai-generation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.ai-generation-layout:has(.ai-result-panel:not(.hidden)) {
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.ai-generation-form {
  display: grid;
  gap: 14px;
  width: 100%;
}

.ai-usage-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-2) 82%, var(--accent) 8%);
}

.ai-usage-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-usage-card span,
.ai-usage-card small {
  color: var(--muted);
  font-weight: 800;
}

.ai-usage-card strong {
  font-size: 1.15rem;
  color: var(--text);
}

.ai-usage-card.is-limit {
  border-color: var(--danger-border);
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface) 30%);
}

.ai-image-recommendation {
  display: grid;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--card-border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-faint) 65%, var(--surface) 35%);
}

.ai-image-recommendation > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-image-recommendation span,
.ai-image-recommendation strong {
  font-weight: 900;
}

.ai-image-recommendation strong {
  color: var(--accent-strong);
}

.ai-image-recommendation p,
.ai-image-recommendation small {
  margin: 0;
  line-height: 1.55;
  text-align: start;
  unicode-bidi: plaintext;
}

.ai-image-recommendation p {
  color: var(--text);
}

.ai-image-recommendation small {
  color: var(--danger);
  font-weight: 800;
}

.ai-usage-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-border) 72%, transparent);
}

.ai-usage-progress i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s var(--ease-soft);
}

.ai-usage-card.is-limit .ai-usage-progress i {
  background: var(--danger);
}

.field-label {
  display: inline-block;
  color: var(--text);
  font-weight: 900;
}

.ai-template-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  width: 100%;
}

.ai-template-option {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--input-bg);
  text-align: start;
  cursor: pointer;
}

.ai-template-option strong {
  font-size: 0.95rem;
}

.ai-template-option small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.ai-template-option[aria-checked="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-faint) 72%, var(--input-bg) 28%);
  box-shadow: var(--focus-ring);
}

.employee-body .field-block.ai-prompt-block > span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 900;
}

.employee-body .field-block.ai-prompt-block .ai-prompt-output {
  min-height: 64px;
  max-height: 86px;
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
  resize: none;
  cursor: default;
  caret-color: transparent;
  overflow-y: auto;
  border-style: dashed;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 74%, transparent);
  box-shadow: none;
}

.employee-body .field-block.ai-prompt-block .ai-prompt-output:focus,
.employee-body .field-block.ai-prompt-block .ai-prompt-output:focus-visible {
  outline: none;
  border-color: var(--card-border);
  box-shadow: none;
}

.ai-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.ai-external-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  white-space: nowrap;
}

.ai-external-btn svg,
.ai-external-btn i {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.ai-provider-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 5px;
  object-fit: contain;
}

.ai-dialog-actions button:disabled,
.ai-generator-links button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
  box-shadow: none;
}

.ai-generator-links {
  display: grid;
  gap: 8px;
}

.ai-generator-links > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.ai-generator-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

#employeeAiCopyPromptBtn {
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px var(--accent-halo);
}

#employeeAiCopyPromptBtn:hover {
  filter: brightness(1.04);
  box-shadow: 0 14px 26px var(--accent-halo);
}

.ai-result-panel {
  display: grid;
  gap: 12px;
}

.ai-generated-preview {
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
    var(--surface-2);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.ai-generated-preview img {
  max-width: min(100%, 360px);
  max-height: 360px;
  object-fit: contain;
}

.employee-image-editor-dialog {
  width: min(1120px, calc(100vw - 28px));
}

.image-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
}

.image-editor-canvas {
  position: relative;
  min-height: clamp(300px, 58vh, 620px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.2) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.2) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.2) 75%),
    var(--surface-2);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.image-editor-canvas.is-cropping {
  cursor: default;
}

.image-editor-canvas.has-crop:not(.is-cropping)::after {
  content: "القص محدد";
  position: absolute;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  padding: 6px 10px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-xs);
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent) 12%);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.image-editor-canvas img {
  max-width: min(100%, 720px);
  max-height: clamp(260px, 54vh, 580px);
  object-fit: contain;
  transform-origin: center;
  transition:
    transform 0.2s var(--ease-out),
    filter 0.2s var(--ease-soft);
}

.image-crop-selection {
  position: absolute;
  z-index: 2;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow:
    0 0 0 9999px rgba(15, 23, 42, 0.34),
    0 8px 18px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

.image-crop-selection [data-crop-handle] {
  position: absolute;
  z-index: 3;
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.24);
  pointer-events: auto;
}

.image-crop-selection [data-crop-handle="nw"] {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.image-crop-selection [data-crop-handle="n"] {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.image-crop-selection [data-crop-handle="ne"] {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.image-crop-selection [data-crop-handle="e"] {
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.image-crop-selection [data-crop-handle="se"] {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.image-crop-selection [data-crop-handle="s"] {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.image-crop-selection [data-crop-handle="sw"] {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.image-crop-selection [data-crop-handle="w"] {
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.image-editor-tools {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.image-editor-tool-stack {
  display: grid;
  gap: 8px;
}

.image-editor-tool-stack > button,
.rotate-tool-row > button {
  width: 100%;
  min-height: 42px;
  justify-content: center;
  gap: 8px;
}

.image-editor-tools button .editor-btn-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 2.25;
}

.rotate-tool-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.image-editor-tools .secondary-btn.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.image-editor-tools .primary-btn.small-btn {
  min-height: 40px;
}

.toggle-row,
.range-row {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.range-row input {
  width: 100%;
  accent-color: var(--accent);
}

@media (max-width: 820px) {
  .ai-generation-layout,
  .image-editor-layout {
    grid-template-columns: 1fr;
  }

  .ai-template-selector {
    grid-template-columns: 1fr;
  }

  .ai-generated-preview,
  .image-editor-canvas {
    min-height: 280px;
  }
}

.items-preview,
.equation-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
}

.items-preview.compact,
.equation-preview.compact {
  font-size: 1rem;
}

.preview-item {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
}

.preview-item.image-item img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: var(--radius-xs);
}

.equation-op,
.equation-placeholder,
.inline-op {
  color: var(--muted);
  font-weight: 900;
}

.contributions-list {
  max-height: none;
}

.approved-hints-section,
.available-hints-section {
  margin-top: 18px;
}

.hint-bank-dialog .approved-hints-grid {
  grid-template-columns: minmax(0, 1fr);
}

.hint-bank-dialog .cards-bank-list {
  max-height: min(58vh, 620px);
}

.hint-bank-dialog {
  width: min(1180px, calc(100% - 32px));
}

.hint-bank-basket {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--metadata-top), var(--metadata-bottom));
  box-shadow: var(--shadow-soft);
}

.hint-bank-basket__head,
.hint-bank-basket__grid {
  display: grid;
  gap: 10px;
}

.hint-bank-basket__head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

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

.compact-field {
  margin-bottom: 8px;
}

.compact-list {
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
}

.compact-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.compact-head {
  margin-bottom: 8px;
}

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

.cards-bank-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-inline-end: 2px;
}

.bank-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  transition:
    border-color 0.2s var(--ease-soft),
    box-shadow 0.2s var(--ease-soft),
    transform 0.2s var(--ease-out);
}

.bank-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 12px 24px rgba(32, 46, 66, 0.1);
  transform: translateY(-1px);
}

.bank-card--selected {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: linear-gradient(180deg, var(--surface-3), var(--accent-soft));
}

.bank-card__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.bank-card__head strong {
  font-weight: 800;
  font-size: 1.02rem;
}

.bank-card__preview {
  min-height: 30px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  background: var(--surface-2);
}

.warning-badges,
.similar-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warning-badge,
.similar-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--warning-border, var(--card-border));
  background: var(--warning-soft, var(--card-bg));
  color: var(--warning, var(--muted));
  font-size: 0.82rem;
  font-weight: 800;
}

.warning-badge-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.warning-badge-btn:hover,
.warning-badge-btn:focus-visible {
  border-color: rgba(217, 119, 6, 0.42);
  color: #92400e;
  background: rgba(254, 243, 199, 0.92);
}

.similar-card-link {
  border-color: var(--card-border);
  background: var(--input-bg);
  color: var(--text);
}

.icon-mini-btn {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xs);
  background: var(--panel-bg);
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 0.2s var(--ease-soft),
    transform 0.15s var(--ease-out);
}

.icon-mini-btn:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.hint-item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hint-item-row span {
  padding: 4px 8px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-weight: 800;
}

.bank-image-preview,
.employee-preview {
  display: grid;
  gap: 6px;
}

.bank-image-preview--grid {
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
}

.bank-image-preview figure {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.bank-image-preview figcaption {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.bank-image-preview img,
.employee-preview img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  box-shadow: var(--shadow-soft);
}

.bank-text-preview {
  white-space: pre-wrap;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

@media (max-width: 980px) {
  .portal-grid,
  .approved-hints-grid,
  .hint-bank-basket__grid,
  .hint-bank-basket__head {
    grid-template-columns: 1fr;
  }

  .employee-item-row {
    grid-template-columns: 1fr 1fr;
  }

  .portal-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

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

  .employee-form-panel,
  .employee-preview-panel {
    width: 100%;
  }

  .employee-preview-panel {
    position: static;
  }
}

@keyframes surface-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ── Studio UX redesign: open workspace, not nested boxes ─────────── */
.admin-body,
.employee-body {
  background:
    linear-gradient(rgba(15, 118, 110, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, var(--bg) 0%, #eef7f6 48%, var(--bg-2) 100%);
  background-size: 36px 36px, 36px 36px, auto;
}

.app-layout {
  max-width: none;
  grid-template-columns: 282px minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 18px 16px;
  gap: 16px;
  background:
    linear-gradient(180deg, #111827 0%, #132033 58%, #0f172a 100%);
  color: #edf2f7;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .meta-note,
.sidebar .brand-subtitle {
  color: rgba(237, 242, 247, 0.68);
}

.sidebar .eyebrow {
  color: #5eead4;
}

.brand-card,
.workspace-nav,
.sidebar-footer {
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.brand-card {
  padding: 8px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
}

.brand-card::before {
  display: none;
}

.brand-card h1 {
  color: #fff;
  font-size: 1.28rem;
}

.brand-mark {
  border: 0;
  box-shadow: none;
}

.workspace-nav {
  padding: 0;
}

.nav-btn {
  color: rgba(237, 242, 247, 0.84);
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 46px;
}

.nav-btn__icon {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(237, 242, 247, 0.86);
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(94, 234, 212, 0.2);
  color: #fff;
  box-shadow: none;
}

.nav-btn.active {
  box-shadow: inset 4px 0 0 #2dd4bf;
}

.main-content {
  min-height: 100vh;
  padding: 30px clamp(22px, 3vw, 44px) 60px;
}

.workspace-page.active {
  display: grid;
  gap: 30px;
}

.panel,
.portal-topbar,
.portal-tabs,
.auth-card {
  backdrop-filter: none;
}

.panel {
  position: relative;
  margin: 0;
  padding: 0 0 30px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
  opacity: 1;
}

.panel + .panel {
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.panel:hover {
  border-color: var(--border);
}

.panel-head {
  padding: 0 0 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 2rem);
  line-height: 1.25;
}

.panel-head h3,
.result-card h3 {
  font-size: 1.05rem;
}

.field-block,
.result-card,
.compact-summary,
.metadata-section,
.filter-toolbar,
.upload-settings-block,
.hint-bank-basket {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.field-block,
.result-card,
.compact-summary {
  padding: 0;
}

.metadata-section {
  margin-top: 24px;
  padding: 24px 0 0;
  border-top: 1px dashed var(--border-strong);
}

.filter-toolbar {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  align-items: end;
}

.form-grid,
.results-grid {
  gap: 22px 28px;
}

.builder-top-row,
.builder-mid-row,
.builder-target-row {
  gap: 22px 28px;
}

.field-block label,
.filter-label {
  font-size: 0.84rem;
  color: var(--muted);
}

.field-block input,
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select,
.auth-form input {
  border: 0;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.6);
  padding-inline: 0;
  box-shadow: none;
}

.field-block input:focus-visible,
.field-block textarea:focus-visible,
.field-block select:focus-visible,
.filter-toolbar input:focus-visible,
.filter-toolbar select:focus-visible,
.auth-form input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 0 -6px var(--accent-soft);
}

.field-block textarea {
  min-height: 156px;
}

.field-block .field-block {
  margin-top: 18px;
}

.result-card {
  padding-inline-start: 16px;
  border-inline-start: 3px solid var(--accent-border);
}

.group-card,
.level-card,
.bank-card,
.employee-item-row,
.stat-card,
.variant-card,
.notice-item,
.path-item,
.random-card,
.level-type-card,
.editor-empty,
.image-entry,
.hint-editor-card,
.hint-line {
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(32, 46, 66, 0.06);
}

.bank-card,
.level-card,
.group-card {
  position: relative;
  overflow: hidden;
}

.bank-card::before,
.level-card::before,
.group-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.primary-btn,
.secondary-btn,
.icon-btn,
.option-chip {
  border-radius: 8px;
}

.primary-btn {
  box-shadow: 0 12px 22px var(--accent-halo);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.7);
}

.portal-layout {
  width: min(1680px, 100%);
  padding: 0 clamp(18px, 3vw, 44px) 54px;
}

.portal-topbar {
  margin-inline: calc(clamp(18px, 3vw, 44px) * -1);
  margin-bottom: 0;
  padding: 24px clamp(18px, 3vw, 44px);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(79, 70, 229, 0.08)),
    rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.portal-tabs {
  margin-inline: calc(clamp(18px, 3vw, 44px) * -1);
  margin-bottom: 26px;
  padding: 0 clamp(18px, 3vw, 44px);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: none;
}

.portal-tab {
  min-height: 54px;
  border-radius: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
}

.portal-tab.active {
  background: transparent;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.employee-compose-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: clamp(22px, 3vw, 42px);
}

.employee-form-panel,
.employee-preview-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.employee-preview-panel {
  top: 22px;
  padding: 0;
}

.employee-live-preview {
  min-height: 420px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(19, 32, 51, 0.92), rgba(17, 24, 39, 0.96));
  color: #edf2f7;
  box-shadow: 0 24px 44px rgba(17, 24, 39, 0.18);
}

.employee-live-preview .meta-note,
.employee-live-preview .equation-op,
.employee-live-preview .equation-placeholder,
.employee-live-preview .inline-op {
  color: rgba(237, 242, 247, 0.66);
}

.employee-preview-title {
  border-color: rgba(255, 255, 255, 0.14);
}

.employee-preview-words,
.preview-item {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.employee-preview-words span {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.hint-bank-dialog,
.app-dialog {
  border-radius: 14px;
}

.hint-bank-basket {
  padding-top: 16px;
  border-top: 1px dashed var(--border-strong);
}

.compact-list-item {
  border-radius: 8px;
}

.auth-card {
  border: 0;
  border-radius: 18px;
}

@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .workspace-nav {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .main-content,
  .portal-layout {
    padding-inline: 16px;
  }

  .portal-topbar,
  .portal-tabs {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .employee-compose-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Premium UX v2: calm command workspace ───────────────────────── */
.admin-body,
.employee-body,
.auth-body {
  background:
    radial-gradient(900px 520px at 86% -12%, rgba(20, 184, 166, 0.14), transparent 58%),
    radial-gradient(780px 480px at 8% 4%, rgba(245, 158, 11, 0.09), transparent 54%),
    linear-gradient(145deg, #f7fafc 0%, #eef5f6 46%, #f8fafc 100%);
  background-size: auto;
}

.app-layout {
  display: block;
  padding: 18px clamp(18px, 2.4vw, 34px) 56px;
  max-width: 1780px;
}

.sidebar {
  position: sticky;
  top: 14px;
  z-index: 100;
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px;
  margin: 0 auto 32px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.66)),
    rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(209, 222, 232, 0.85);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
  backdrop-filter: blur(22px) saturate(1.15);
}

.sidebar .meta-note,
.sidebar .brand-subtitle {
  color: var(--muted);
}

.sidebar .eyebrow {
  color: var(--accent);
}

.brand-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 2px 4px;
  border: 0;
}

.brand-card .eyebrow,
.brand-card .brand-subtitle {
  display: none;
}

.brand-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

.brand-mark {
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 14px;
  background:
    linear-gradient(135deg, #132033 0%, #0f766e 58%, #d99a20 100%);
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.2);
}

.workspace-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  overflow: visible;
  background: rgba(241, 245, 249, 0.72);
  border: 1px solid rgba(209, 222, 232, 0.74);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.nav-btn {
  width: auto;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
}

.nav-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(209, 222, 232, 0.95);
}

.nav-btn.active {
  color: #fff;
  background:
    linear-gradient(135deg, #132033 0%, #0f766e 100%);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.18);
}

.nav-btn.active .nav-btn__icon {
  background: rgba(255, 255, 255, 0.12);
}

.nav-btn__icon {
  width: 26px;
  height: 26px;
  border: 0;
  background: rgba(19, 32, 51, 0.06);
  color: currentColor;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
  margin: 0;
}

.sidebar-footer .meta-note {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  min-height: auto;
  padding: 0;
  max-width: 1500px;
  margin: 0 auto;
}

.workspace-page.active {
  gap: clamp(30px, 4vw, 52px);
}

.panel {
  padding-bottom: clamp(30px, 4vw, 52px);
}

.panel + .panel {
  padding-top: clamp(26px, 3vw, 38px);
  border-top: 1px solid rgba(184, 197, 211, 0.62);
}

.panel-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(184, 197, 211, 0.55);
}

.panel-head::after {
  content: "";
  position: absolute;
  inset-block-end: -1px;
  inset-inline-start: 0;
  width: 86px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #d99a20);
}

.panel-head h2 {
  font-size: clamp(1.55rem, 1.18rem + 1.15vw, 2.42rem);
}

.panel-head .meta-note {
  max-width: 760px;
}

.builder-target-row {
  grid-template-columns: minmax(260px, 1.2fr) minmax(180px, 0.55fr);
}

.builder-top-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(220px, 0.75fr) repeat(3, minmax(160px, 0.55fr));
}

.builder-mid-row {
  display: grid;
  grid-template-columns: minmax(420px, 1.35fr) minmax(260px, 0.55fr);
}

.metadata-section .results-grid {
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
}

.form-grid,
.results-grid,
.metadata-grid {
  gap: 26px 34px;
}

.field-block input,
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select,
.auth-form input {
  background: rgba(255, 255, 255, 0.54);
  border-bottom-color: rgba(139, 154, 173, 0.5);
}

.field-block input:hover,
.field-block textarea:hover,
.field-block select:hover,
.filter-toolbar input:hover,
.filter-toolbar select:hover {
  border-bottom-color: rgba(15, 118, 110, 0.55);
}

.field-block textarea {
  background:
    linear-gradient(rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.46));
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(180px, 0.36fr));
  gap: 16px 20px;
  align-items: end;
}

.button-row,
.panel-footer-actions {
  gap: 10px;
}

.primary-btn,
.secondary-btn {
  min-height: 42px;
  padding-inline: 16px;
}

.primary-btn {
  background:
    linear-gradient(135deg, #132033 0%, #0f766e 72%, #d99a20 150%);
  box-shadow: 0 16px 34px rgba(15, 118, 110, 0.18);
}

.primary-btn:hover {
  box-shadow: 0 20px 42px rgba(15, 118, 110, 0.22);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(184, 197, 211, 0.7);
}

.secondary-btn:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: #fff;
}

.group-card,
.level-card,
.bank-card,
.stat-card,
.variant-card,
.notice-item,
.path-item,
.random-card,
.level-type-card,
.editor-empty,
.image-entry,
.hint-editor-card,
.hint-line {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.72));
  border-color: rgba(209, 222, 232, 0.9);
  box-shadow: 0 18px 38px rgba(31, 41, 55, 0.08);
}

.bank-card:hover,
.level-card:hover,
.group-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px rgba(31, 41, 55, 0.12);
}

.bank-card::before,
.level-card::before,
.group-card::before {
  width: 3px;
  background: linear-gradient(180deg, #0f766e, #d99a20);
}

.grid-cell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 244, 244, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 22px rgba(31, 41, 55, 0.1);
}

.portal-layout {
  width: min(1500px, 100%);
  padding-top: 20px;
}

.portal-topbar {
  margin: 0 0 18px;
  padding: 18px 0 20px;
  background: transparent;
  border-bottom: 1px solid rgba(184, 197, 211, 0.58);
}

.portal-topbar h1 {
  font-size: clamp(1.7rem, 1.28rem + 1.2vw, 2.7rem);
}

.portal-tabs {
  margin: 0 0 30px;
  padding: 0;
  background: transparent;
  border-bottom-color: rgba(184, 197, 211, 0.58);
}

.portal-tab {
  min-height: 48px;
  padding-inline: 18px;
}

.employee-compose-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.7fr);
  align-items: start;
}

.employee-live-preview {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 0;
  border-radius: 28px;
  background:
    radial-gradient(260px 180px at 88% 12%, rgba(20, 184, 166, 0.26), transparent 62%),
    linear-gradient(145deg, #0f172a 0%, #132033 52%, #111827 100%);
  box-shadow: 0 30px 90px rgba(17, 24, 39, 0.25);
}

.employee-live-preview::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  pointer-events: none;
}

.employee-item-row {
  background: rgba(255, 255, 255, 0.72);
}

.app-dialog {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
  box-shadow: 0 40px 110px rgba(15, 23, 42, 0.24);
}

.hint-bank-dialog {
  width: min(1240px, calc(100% - 32px));
}

.hint-bank-dialog .approved-hints-grid {
  gap: 24px;
}

.cards-bank-list {
  gap: 14px;
}

@media (max-width: 1220px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar-footer {
    justify-content: space-between;
  }

  .builder-top-row,
  .builder-mid-row,
  .builder-target-row,
  .metadata-section .results-grid,
  .employee-compose-grid {
    grid-template-columns: 1fr;
  }

  .employee-preview-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-layout,
  .portal-layout {
    padding-inline: 14px;
  }

  .sidebar {
    top: 8px;
    padding: 10px;
    border-radius: 18px;
  }

  .brand-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .workspace-nav {
    justify-content: flex-start;
  }

  .filter-toolbar,
  .form-grid,
  .results-grid,
  .backup-options-grid,
  .backup-schedule-grid {
    grid-template-columns: 1fr;
  }

  .employee-live-preview {
    min-height: 340px;
    border-radius: 22px;
  }
}

/* ── Night Luxe final direction ───────────────────────────────────── */
:root {
  --bg: #070b1a;
  --bg-2: #0c1230;
  --surface: rgba(14, 22, 52, 0.82);
  --surface-2: rgba(18, 27, 61, 0.82);
  --surface-3: rgba(21, 31, 70, 0.78);
  --panel-bg: rgba(14, 22, 52, 0.82);
  --metadata-bg: rgba(18, 27, 61, 0.82);
  --text: #f5f7ff;
  --muted: #aab6df;
  --border: rgba(94, 112, 190, 0.34);
  --border-strong: rgba(139, 92, 246, 0.58);
  --accent: #8b5cf6;
  --accent-strong: #38bdf8;
  --success: #34d399;
  --warning: #f7b955;
  --danger: #fb7185;
  --accent-soft: rgba(139, 92, 246, 0.18);
  --accent-faint: rgba(56, 189, 248, 0.1);
  --accent-border: rgba(139, 92, 246, 0.42);
  --accent-halo: rgba(139, 92, 246, 0.22);
  --input-bg: rgba(9, 15, 36, 0.76);
  --card-bg: rgba(13, 21, 50, 0.82);
  --card-border: rgba(94, 112, 190, 0.34);
  --chip-bg: rgba(18, 28, 66, 0.82);
  --panel-border: rgba(94, 112, 190, 0.32);
  --nav-bg: rgba(9, 15, 36, 0.78);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 16px 48px rgba(0, 0, 0, 0.28);
  --focus-ring: 0 0 0 4px rgba(139, 92, 246, 0.18);
  --cell-bg-top: rgba(28, 40, 88, 0.98);
  --cell-bg-bottom: rgba(13, 23, 58, 0.98);
  --cell-border: rgba(117, 136, 220, 0.42);
  --empty-cell-a: rgba(18, 27, 61, 0.9);
  --empty-cell-b: rgba(10, 17, 41, 0.9);
}

body,
.admin-body,
.employee-body,
.auth-body {
  color: var(--text);
  background:
    radial-gradient(780px 520px at 84% -12%, rgba(139, 92, 246, 0.28), transparent 62%),
    radial-gradient(720px 500px at 6% 8%, rgba(56, 189, 248, 0.18), transparent 58%),
    radial-gradient(520px 420px at 52% 104%, rgba(124, 58, 237, 0.16), transparent 64%),
    linear-gradient(145deg, #050816 0%, #090f24 42%, #0e1536 100%);
}

.app-layout,
.portal-layout {
  color: var(--text);
}

.sidebar,
.portal-topbar,
.portal-tabs,
.auth-card,
.app-dialog {
  background:
    linear-gradient(135deg, rgba(16, 25, 58, 0.9), rgba(10, 16, 39, 0.82));
  border: 1px solid rgba(122, 143, 232, 0.22);
  box-shadow:
    0 28px 88px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(1.12);
}

.brand-card h1,
.portal-topbar h1,
.panel-head h2,
.panel-head h3,
.result-card h3,
.auth-card h1 {
  color: #ffffff;
}

.brand-card .eyebrow,
.portal-topbar .eyebrow,
.auth-card .eyebrow,
.eyebrow {
  color: #a78bfa;
}

.brand-mark {
  background:
    linear-gradient(135deg, #8b5cf6 0%, #4338ca 48%, #38bdf8 100%);
  box-shadow:
    0 18px 38px rgba(139, 92, 246, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.workspace-nav {
  background: rgba(5, 10, 28, 0.62);
  border-color: rgba(122, 143, 232, 0.2);
}

.nav-btn {
  color: #b7c3ea;
}

.nav-btn__icon {
  background: rgba(139, 92, 246, 0.12);
  color: currentColor;
}

.nav-btn:hover {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(56, 189, 248, 0.08));
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.22);
}

.nav-btn.active {
  color: #fff;
  background:
    linear-gradient(135deg, #6d28d9 0%, #4338ca 52%, #0369a1 100%);
  box-shadow:
    0 16px 34px rgba(79, 70, 229, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.sidebar .meta-note,
.sidebar .brand-subtitle,
.meta-note,
.muted,
.hint {
  color: var(--muted);
}

.panel + .panel,
.panel-head,
.portal-tabs,
.portal-topbar {
  border-color: rgba(122, 143, 232, 0.22);
}

.panel-head::after {
  background: linear-gradient(90deg, #8b5cf6, #38bdf8);
  box-shadow: 0 0 22px rgba(139, 92, 246, 0.5);
}

.field-block label,
.filter-label {
  color: #cad4ff;
}

.field-block input,
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select,
.auth-form input,
.shared-count-field input,
.upload-options-grid input,
.upload-options-grid select {
  min-height: 46px;
  padding: 10px 13px;
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgba(13, 21, 50, 0.82), rgba(8, 14, 34, 0.86));
  border: 1px solid rgba(122, 143, 232, 0.25);
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 26px rgba(0, 0, 0, 0.12);
}

.field-block textarea {
  background:
    linear-gradient(180deg, rgba(13, 21, 50, 0.86), rgba(8, 14, 34, 0.88));
}

.field-block input::placeholder,
.field-block textarea::placeholder,
.filter-toolbar input::placeholder {
  color: rgba(202, 212, 255, 0.5);
}

.field-block input:hover,
.field-block textarea:hover,
.field-block select:hover,
.filter-toolbar input:hover,
.filter-toolbar select:hover {
  border-color: rgba(139, 92, 246, 0.48);
}

.field-block input:focus-visible,
.field-block textarea:focus-visible,
.field-block select:focus-visible,
.filter-toolbar input:focus-visible,
.filter-toolbar select:focus-visible,
.auth-form input:focus-visible {
  border-color: #a78bfa;
  box-shadow:
    var(--focus-ring),
    0 0 34px rgba(139, 92, 246, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primary-btn {
  background:
    linear-gradient(135deg, #8b5cf6 0%, #4f46e5 52%, #0284c7 100%);
  box-shadow:
    0 18px 42px rgba(79, 70, 229, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.primary-btn:hover {
  box-shadow:
    0 22px 54px rgba(79, 70, 229, 0.36),
    0 0 28px rgba(139, 92, 246, 0.2);
}

.secondary-btn,
.option-chip,
.status-pill {
  color: #e7ecff;
  background: rgba(14, 22, 52, 0.72);
  border-color: rgba(122, 143, 232, 0.28);
}

.secondary-btn:hover,
.option-chip:hover {
  background: rgba(24, 34, 76, 0.88);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

.danger-btn {
  color: #fda4af;
}

.group-card,
.level-card,
.bank-card,
.stat-card,
.variant-card,
.notice-item,
.path-item,
.random-card,
.level-type-card,
.editor-empty,
.image-entry,
.hint-editor-card,
.hint-line,
.employee-item-row,
.compact-list-item,
.employee-preview-words,
.preview-item,
.shared-count-field,
.upload-settings-block,
.upload-file-card {
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(17, 26, 60, 0.88), rgba(10, 17, 41, 0.78));
  border-color: rgba(122, 143, 232, 0.24);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.bank-card:hover,
.level-card:hover,
.group-card:hover,
.employee-item-row:hover {
  border-color: rgba(167, 139, 250, 0.52);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.32),
    0 0 34px rgba(139, 92, 246, 0.12);
}

.bank-card::before,
.level-card::before,
.group-card::before {
  background: linear-gradient(180deg, #8b5cf6, #38bdf8);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.44);
}

.badge,
.warning-badge,
.similar-card-link,
.hint-item-row span,
.employee-preview-words span {
  color: #e7ecff;
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.32);
}

.bank-image-preview img,
.employee-preview img,
.preview-image img {
  border-color: rgba(122, 143, 232, 0.34);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

.employee-live-preview {
  background:
    radial-gradient(320px 220px at 85% 12%, rgba(139, 92, 246, 0.32), transparent 64%),
    radial-gradient(240px 200px at 18% 24%, rgba(56, 189, 248, 0.16), transparent 66%),
    linear-gradient(145deg, #050816 0%, #090f24 44%, #121a3f 100%);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.42),
    0 0 48px rgba(139, 92, 246, 0.12);
}

.employee-live-preview::before {
  border-color: rgba(167, 139, 250, 0.16);
}

.app-dialog::backdrop {
  background:
    radial-gradient(500px 360px at 50% 0%, rgba(139, 92, 246, 0.18), transparent 62%),
    rgba(2, 6, 23, 0.72);
}

.status-success {
  color: #86efac;
}

.status-warning {
  color: #fde68a;
}

.status-error {
  color: #fda4af;
}

.grid-cell {
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgba(31, 43, 92, 0.98), rgba(12, 20, 50, 0.98));
  border-color: rgba(122, 143, 232, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 34px rgba(0, 0, 0, 0.25);
}

.auth-body .auth-card {
  max-width: 460px;
}

.auth-card a {
  color: #bfdbfe;
}

/* ── Final calm workspace redesign ────────────────────────────────── */
:root,
:root[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-2: #edf3fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #eef5ff;
  --panel-bg: #ffffff;
  --metadata-bg: #f8fbff;
  --text: #142033;
  --muted: #64748b;
  --border: #d8e3f2;
  --border-strong: #b8c8dd;
  --accent: #2563eb;
  --accent-strong: #4f46e5;
  --success: #15803d;
  --warning: #b45309;
  --danger: #dc2626;
  --success-soft: rgba(21, 128, 61, 0.1);
  --success-border: rgba(21, 128, 61, 0.24);
  --warning-soft: rgba(180, 83, 9, 0.12);
  --warning-border: rgba(180, 83, 9, 0.24);
  --danger-soft: rgba(220, 38, 38, 0.1);
  --danger-border: rgba(220, 38, 38, 0.22);
  --shadow: 0 20px 54px rgba(23, 37, 84, 0.08);
  --shadow-soft: 0 10px 28px rgba(23, 37, 84, 0.07);
  --accent-halo: rgba(37, 99, 235, 0.15);
  --panel-border: rgba(216, 227, 242, 0.92);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-faint: rgba(79, 70, 229, 0.07);
  --accent-border: rgba(37, 99, 235, 0.28);
  --input-bg: #f8fbff;
  --card-bg: #ffffff;
  --card-border: #dce7f6;
  --chip-bg: #eef5ff;
  --cell-border: #b9cce8;
  --cell-bg-top: #ffffff;
  --cell-bg-bottom: #edf5ff;
  --empty-cell-a: #eef4fb;
  --empty-cell-b: #e4edf8;
  --coord-color: rgba(20, 32, 51, 0.42);
  --focus-outline: rgba(37, 99, 235, 0.24);
  --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

:root[data-theme="dark"] {
  --bg: #0f172a;
  --bg-2: #111827;
  --surface: #172033;
  --surface-2: #111a2d;
  --surface-3: #1d2a44;
  --panel-bg: #172033;
  --metadata-bg: #111a2d;
  --text: #f8fafc;
  --muted: #b8c4d8;
  --border: #2d3b55;
  --border-strong: #465a78;
  --accent: #60a5fa;
  --accent-strong: #a78bfa;
  --success: #6ee7b7;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.18);
  --accent-halo: rgba(96, 165, 250, 0.16);
  --panel-border: rgba(70, 90, 120, 0.72);
  --nav-bg: rgba(23, 32, 51, 0.9);
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-faint: rgba(167, 139, 250, 0.1);
  --accent-border: rgba(96, 165, 250, 0.32);
  --input-bg: #101a2e;
  --card-bg: #172033;
  --card-border: #2d3b55;
  --chip-bg: #1d2a44;
  --cell-border: #465a78;
  --cell-bg-top: #1d2a44;
  --cell-bg-bottom: #121c31;
  --empty-cell-a: #172033;
  --empty-cell-b: #111827;
  --coord-color: rgba(248, 250, 252, 0.36);
  --focus-outline: rgba(96, 165, 250, 0.26);
  --focus-ring: 0 0 0 4px rgba(96, 165, 250, 0.16);
}

html {
  scroll-behavior: smooth;
}

body,
button,
input,
textarea,
select {
  letter-spacing: 0 !important;
}

body.admin-body,
body.employee-body,
body.auth-body {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 360px),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

.admin-body .app-layout {
  width: min(100%, 1720px);
  max-width: none;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 28px;
  padding: 28px;
  align-items: start;
  direction: ltr;
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  direction: rtl;
  position: sticky;
  top: 28px;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.main-content {
  grid-column: 1;
  grid-row: 1;
  direction: rtl;
  min-width: 0;
  display: block;
  padding: 0;
}

.brand-card,
.workspace-nav,
.sidebar-footer,
.portal-topbar,
.portal-tabs,
.panel,
.app-dialog,
.auth-card {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.brand-card {
  padding: 22px;
  border-radius: 24px;
  overflow: hidden;
}

.sidebar .brand-card,
.sidebar .workspace-nav,
.sidebar .sidebar-footer {
  box-shadow: none;
}

.sidebar .brand-card {
  padding: 10px 8px 14px;
  background: transparent;
  border-color: transparent;
}

.sidebar .workspace-nav {
  background: var(--surface-2);
}

.sidebar .sidebar-footer {
  background: var(--surface-2);
}

.brand-card::before {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong), #0f766e);
  opacity: 1;
}

.brand-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 32px var(--accent-halo);
}

.brand-card h1,
.portal-topbar h1,
.panel h2,
.panel h3 {
  color: var(--text);
  font-weight: 800;
  line-height: 1.35;
}

.brand-card h1 {
  margin-bottom: 10px;
  font-size: 1.42rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-subtitle,
.meta-note,
.muted,
.hint {
  color: var(--muted);
}

.workspace-nav {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 20px;
}

.nav-btn {
  min-height: 48px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  justify-content: start;
  padding: 11px 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  box-shadow: none;
  text-align: start;
}

.nav-btn__icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: none;
  transform: translateX(-2px);
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  box-shadow: 0 16px 36px var(--accent-halo);
}

.nav-btn.active .nav-btn__icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.17);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.workspace-page {
  display: none;
}

.workspace-page.active {
  display: grid;
  gap: 26px;
}

.panel {
  margin: 0;
  padding: 28px;
  border-radius: 24px;
  overflow: visible;
}

.panel + .panel {
  margin-top: 0;
}

.panel-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head::after {
  display: none;
}

.panel-head h2,
.panel-head h3 {
  margin: 0 0 6px;
}

.button-row,
.panel-footer-actions,
.toolbar,
.random-hint-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.panel-footer-actions {
  justify-content: flex-start;
  margin-top: 24px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.option-chip,
.status-pill,
.icon-mini-btn {
  min-height: 42px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: none;
  transition:
    transform 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out),
    background 0.18s var(--ease-out);
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 34px var(--accent-halo);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 42px var(--accent-halo);
}

.secondary-btn,
.option-chip,
.status-pill,
.icon-mini-btn {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.secondary-btn:hover,
.option-chip:hover,
.icon-mini-btn:hover {
  color: var(--accent);
  background: #fff;
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

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

.small-btn,
.icon-mini-btn {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.form-grid,
.compact-grid,
.builder-top-row,
.builder-target-row,
.builder-mid-row,
.metadata-grid,
.results-grid,
.stats-cards-grid,
.approved-hints-grid,
.upload-options-grid {
  display: grid;
  gap: 22px;
  align-items: start;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.builder-target-row {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-bottom: 22px;
}

.builder-top-row {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 24px;
}

.builder-mid-row {
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.58fr);
  margin-bottom: 26px;
}

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

.stats-cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.field-block,
.filter-field,
.side-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

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

.field-header {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.field-block label,
.filter-label,
.toggle-row {
  color: #334155;
  font-weight: 800;
}

:root[data-theme="dark"] .field-block label,
:root[data-theme="dark"] .filter-label,
:root[data-theme="dark"] .toggle-row {
  color: #e2e8f0;
}

.field-block input:not([type="checkbox"]):not([type="radio"]),
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select,
.auth-form input,
.shared-count-field input,
.upload-options-grid input,
.upload-options-grid select,
.input-stretch {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: none;
  outline: none;
}

.field-block textarea,
.filter-toolbar textarea {
  min-height: 112px;
  resize: vertical;
}

.field-block input::placeholder,
.field-block textarea::placeholder,
.filter-toolbar input::placeholder,
.auth-form input::placeholder {
  color: rgba(100, 116, 139, 0.72);
}

.field-block input:not([type="checkbox"]):not([type="radio"]):hover,
.field-block textarea:hover,
.field-block select:hover,
.filter-toolbar input:hover,
.filter-toolbar select:hover,
.auth-form input:hover {
  border-color: var(--border-strong);
}

.field-block input:not([type="checkbox"]):not([type="radio"]):focus-visible,
.field-block textarea:focus-visible,
.field-block select:focus-visible,
.filter-toolbar input:focus-visible,
.filter-toolbar select:focus-visible,
.auth-form input:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.hidden,
.hidden-file-input,
.hidden-input-store {
  display: none !important;
}

select,
input,
textarea {
  max-width: 100%;
}

.filter-toolbar,
.stacked-toolbars,
.metadata-section,
.toolbar,
.analysis-compact-row {
  display: grid;
  gap: 16px;
}

.filter-toolbar {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.stacked-toolbars {
  margin-bottom: 22px;
}

.metadata-section {
  margin: 28px 0;
  padding: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 22px;
}

.metadata-section .panel-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
}

.group-list,
.levels-list,
.vertical-list,
.cards-bank-list,
.editor-list,
.image-editor-list,
.hint-lines,
.backup-list {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.group-card,
.level-card,
.bank-card,
.stat-card,
.variant-card,
.notice-item,
.path-item,
.random-card,
.level-type-card,
.editor-empty,
.image-entry,
.hint-editor-card,
.hint-line,
.employee-item-row,
.compact-list-item,
.employee-preview-words,
.preview-item,
.shared-count-field,
.upload-settings-block,
.upload-file-card,
.result-card,
.wide-card {
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.group-card,
.level-card,
.bank-card,
.stat-card,
.variant-card,
.result-card,
.hint-editor-card {
  padding: 18px;
}

.bank-card,
.level-card,
.group-card,
.employee-item-row {
  position: relative;
  overflow: hidden;
}

.bank-card::before,
.level-card::before,
.group-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), #0f766e);
  opacity: 0.8;
}

.bank-card:hover,
.level-card:hover,
.group-card:hover,
.employee-item-row:hover {
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(23, 37, 84, 0.11);
  transform: translateY(-1px);
}

.bank-card--selected,
.group-card.active {
  border-color: var(--accent);
  background:
    linear-gradient(0deg, var(--accent-soft), var(--accent-soft)),
    var(--card-bg);
}

.bank-card__head,
.hint-bank-basket__head,
.stat-row,
.word-row,
.hint-editor-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.bank-card__preview,
.employee-live-preview,
.media-preview,
.preview-image,
.bank-image-preview {
  min-width: 0;
}

.badge,
.warning-badge,
.similar-card-link,
.hint-item-row span,
.employee-preview-words span,
.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.82rem;
}

.status-box,
.notice-item,
.compact-note {
  padding: 14px 16px;
  border-radius: 14px;
}

.status-success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
}

.status-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
}

.status-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
}

.image-dropzone {
  min-height: 128px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
}

.grid-board-wrapper {
  max-width: 100%;
  overflow: auto;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.grid-cell {
  color: var(--text);
  background: linear-gradient(180deg, var(--cell-bg-top), var(--cell-bg-bottom));
  border-color: var(--cell-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 8px 18px rgba(23, 37, 84, 0.08);
}

.hint-bank-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(840px, calc(100vh - 32px));
  padding: 24px;
  border-radius: 24px;
}

.hint-bank-dialog .approved-hints-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hint-bank-dialog .cards-bank-list {
  max-height: 480px;
  overflow: auto;
  padding-inline-end: 4px;
}

.hint-bank-basket {
  margin-top: 18px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.hint-bank-basket__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-layout {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 20px;
}

.portal-topbar {
  padding: 22px 26px;
  border-radius: 24px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.portal-topbar h1 {
  margin: 0;
  font-size: clamp(1.45rem, 1.15rem + 1vw, 2.05rem);
}

.portal-tabs {
  width: fit-content;
  max-width: 100%;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  background: var(--surface-3);
  box-shadow: none;
}

.portal-tab {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  color: var(--muted);
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
}

.portal-tab:hover,
.portal-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.employee-compose-grid {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  direction: ltr;
}

.employee-form-panel {
  grid-column: 2;
  direction: rtl;
}

.employee-preview-panel {
  grid-column: 1;
  grid-row: 1;
  direction: rtl;
  position: sticky;
  top: 28px;
}

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

.employee-form-panel .hint-editor-mode,
.employee-form-panel #employeeAnswerField,
.employee-form-panel #employeeLevelWordsField,
.employee-form-panel .panel-footer-actions {
  grid-column: 1 / -1;
}

.employee-items-list {
  display: grid;
  gap: 12px;
}

.employee-item-row {
  display: grid;
  grid-template-columns: auto minmax(110px, 0.32fr) minmax(0, 1fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.employee-item-row .drag-handle {
  cursor: grab;
}

.employee-item-row.dragging {
  opacity: 0.72;
  transform: scale(0.99);
}

.employee-item-row.drag-over {
  border-color: var(--accent);
  box-shadow: var(--focus-ring), var(--shadow-soft);
}

.employee-live-preview {
  min-height: 300px;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 24px;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.employee-live-preview::before {
  display: none;
}

.employee-live-preview .preview-title {
  color: var(--accent);
  font-weight: 900;
}

.preview-item {
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  margin: 4px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

.preview-item img,
.employee-preview img,
.bank-image-preview img,
.preview-image img,
.media-preview img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.employee-preview-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.emoji-dialog {
  width: min(620px, calc(100vw - 28px));
}

emoji-picker {
  width: 100%;
  height: 420px;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 460px);
  padding: 28px;
  border-radius: 24px;
}

@media (max-width: 1180px) {
  .admin-body .app-layout {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .sidebar,
  .main-content {
    grid-column: auto;
    grid-row: auto;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

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

  .builder-top-row,
  .builder-target-row,
  .builder-mid-row,
  .metadata-grid,
  .results-grid,
  .hint-bank-dialog .approved-hints-grid {
    grid-template-columns: 1fr;
  }

  .employee-compose-grid {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .employee-form-panel,
  .employee-preview-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .employee-preview-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .admin-body .app-layout,
  .portal-layout {
    padding: 14px;
    gap: 16px;
  }

  .panel,
  .portal-topbar,
  .auth-card {
    padding: 18px;
    border-radius: 18px;
  }

  .panel-head,
  .portal-topbar,
  .field-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-nav,
  .employee-form-panel .form-grid,
  .form-grid,
  .filter-toolbar {
    grid-template-columns: 1fr;
  }

  .portal-tabs {
    width: 100%;
  }

  .portal-tab {
    flex: 1;
  }

  .button-row,
  .panel-footer-actions {
    align-items: stretch;
  }

  .button-row > *,
  .panel-footer-actions > *,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .employee-item-row {
    grid-template-columns: auto 1fr;
  }

  .employee-item-row input,
  .employee-item-row select {
    grid-column: 1 / -1;
  }

  .employee-item-row .equation-op {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* ── UX refinement pass: inputs, contributor portal, sidebar, KPIs ── */
.admin-body .app-layout {
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 32px;
  padding: 30px;
}

.sidebar {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.sidebar .brand-card {
  position: relative;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(37, 99, 235, 0.16), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, #f6f9ff 100%);
  border: 1px solid rgba(191, 207, 232, 0.94);
  border-radius: 30px;
  box-shadow: 0 24px 62px rgba(37, 58, 113, 0.1);
}

.sidebar .brand-card::after {
  content: "";
  position: absolute;
  inset-inline: 28px;
  inset-block-end: -1px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), #7c3aed, transparent);
}

.sidebar .brand-mark {
  border-radius: 18px;
  transform: rotate(-6deg);
}

.sidebar .workspace-nav {
  position: relative;
  gap: 10px;
  padding: 18px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 255, 0.9));
  border: 1px solid rgba(191, 207, 232, 0.9);
  border-radius: 30px;
  box-shadow: 0 24px 58px rgba(37, 58, 113, 0.09);
  overflow: hidden;
}

.sidebar .workspace-nav::before {
  content: "";
  position: absolute;
  inset-block: 28px;
  inset-inline-start: 31px;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(37, 99, 235, 0.28), rgba(124, 58, 237, 0.24), transparent);
}

.nav-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  grid-template-columns: none;
  min-height: 58px;
  padding: 9px 10px 9px 14px;
  border-radius: 18px;
  isolation: isolate;
  width: 100%;
  justify-content: flex-start;
  text-align: start;
}

.nav-btn__icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.nav-btn span:not(.nav-btn__icon) {
  min-width: 0;
  flex: 1;
  white-space: normal;
  overflow: visible;
}

.nav-btn::after {
  content: "";
  position: absolute;
  inset-block: 12px;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #7c3aed);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
}

.nav-btn.active::after {
  opacity: 1;
  transform: translateX(0);
}

.nav-btn.active {
  background:
    linear-gradient(135deg, #2563eb 0%, #4f46e5 54%, #7c3aed 100%);
}

.sidebar-footer {
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(191, 207, 232, 0.9);
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(37, 58, 113, 0.08);
}

.panel {
  padding: clamp(24px, 2.5vw, 34px);
}

.workspace-page.active {
  gap: 30px;
}

.panel-head {
  gap: 24px;
  margin-bottom: 28px;
}

.form-grid,
.builder-top-row,
.builder-target-row,
.builder-mid-row,
.metadata-grid,
.results-grid,
.filter-toolbar {
  gap: 24px;
}

.builder-top-row {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.builder-target-row {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.builder-mid-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
}

.field-block,
.filter-field {
  gap: 10px;
}

.field-block label,
.filter-label,
.auth-form label > span {
  width: fit-content;
  padding: 0 2px;
  color: #25324a;
  font-size: 0.92rem;
  font-weight: 900;
}

.field-block input:not([type="checkbox"]):not([type="radio"]),
.field-block textarea,
.field-block select,
.filter-toolbar input,
.filter-toolbar select,
.auth-form input,
.shared-count-field input,
.upload-options-grid input,
.upload-options-grid select,
.input-stretch {
  min-height: 52px;
  padding: 13px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.96));
  border: 1px solid #cfdced;
  border-bottom-color: #b8c9df;
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 10px 24px rgba(31, 49, 91, 0.045);
}

.field-block textarea {
  padding-block: 15px;
  line-height: 1.8;
}

.field-block input:not([type="checkbox"]):not([type="radio"]):focus-visible,
.field-block textarea:focus-visible,
.field-block select:focus-visible,
.filter-toolbar input:focus-visible,
.filter-toolbar select:focus-visible,
.auth-form input:focus-visible {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.12),
    0 18px 36px rgba(37, 99, 235, 0.1);
}

.field-block input[readonly] {
  color: #64748b;
  background: linear-gradient(180deg, #f3f7fd, #edf3fb);
}

.filter-toolbar {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(240, 246, 255, 0.9));
}

.employee-body {
  background:
    radial-gradient(circle at 12% 12%, rgba(124, 58, 237, 0.12), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(135deg, #f7faff 0%, #eef5ff 100%) !important;
}

.portal-layout {
  width: 100%;
  max-width: none;
  padding: 0 28px 28px;
  gap: 24px;
}

.portal-topbar {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 28px 32px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 24%),
    linear-gradient(135deg, #172554 0%, #1d4ed8 48%, #6d28d9 100%);
  border: 0;
  box-shadow: 0 28px 78px rgba(30, 64, 175, 0.22);
}

.employee-body .portal-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: 72px;
  margin-inline: -28px;
  padding: 10px 28px;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.09), transparent 18%, transparent 82%, rgba(124, 58, 237, 0.08)),
    rgba(255, 255, 255, 0.9);
  border: 0;
  border-bottom: 1px solid rgba(191, 207, 232, 0.82);
  border-radius: 0;
  box-shadow: 0 16px 42px rgba(37, 58, 113, 0.1);
  backdrop-filter: blur(20px);
}

.employee-body .portal-tabs {
  position: relative;
  top: auto;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.employee-body .portal-topbar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed, #0f766e);
}

.employee-body .portal-topbar h1,
.employee-body .portal-topbar .eyebrow,
.employee-body .portal-topbar .meta-note {
  color: var(--text);
}

.employee-body .portal-topbar .eyebrow {
  color: var(--accent);
}

.employee-body .portal-topbar h1 {
  font-size: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
}

.employee-body .portal-topbar .button-row {
  background: rgba(246, 249, 255, 0.82);
  border-color: rgba(191, 207, 232, 0.9);
}

.employee-body .portal-topbar .secondary-btn {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.employee-body .portal-tabs,
.employee-body .employee-view {
  width: min(1540px, 100%);
  margin-inline: auto;
}

.portal-topbar::before {
  content: "";
  position: absolute;
  inset: -80% auto auto -18%;
  width: 42%;
  height: 260%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: rotate(24deg);
  animation: portal-sheen 6s ease-in-out infinite;
}

.portal-topbar h1,
.portal-topbar .eyebrow,
.portal-topbar .meta-note {
  position: relative;
  color: #fff;
}

.portal-topbar .button-row {
  position: relative;
  padding: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
}

.portal-topbar .secondary-btn {
  color: #172554;
  background: #fff;
  border-color: transparent;
}

.portal-tabs {
  width: min(1540px, 100%);
  display: grid;
  grid-template-columns: minmax(190px, 0.36fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 22px auto 28px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 255, 0.9));
  border: 1px solid rgba(191, 207, 232, 0.86);
  border-radius: 24px;
  box-shadow: 0 20px 52px rgba(37, 58, 113, 0.1);
}

.portal-tabs__context {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 12px 18px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 18px;
}

.portal-tabs__context span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.portal-tabs__context strong {
  color: var(--text);
  font-size: 1.04rem;
}

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

.portal-tab {
  position: relative;
  min-height: 74px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(207, 220, 237, 0.9);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    color 0.24s var(--ease-out),
    background 0.24s var(--ease-out),
    border-color 0.24s var(--ease-out),
    transform 0.24s var(--ease-out),
    box-shadow 0.24s var(--ease-out);
}

.portal-tab::after {
  content: "";
  position: absolute;
  inset-inline: 18px;
  inset-block-end: 9px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  opacity: 0;
  transform: scaleX(0.32);
  transform-origin: center;
  transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out);
}

.portal-tab__mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 14px;
  font-weight: 900;
}

.portal-tab__copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: start;
}

.portal-tab__copy strong {
  font-size: 1rem;
}

.portal-tab__copy small {
  color: var(--muted);
  font-weight: 800;
}

.portal-tab:hover {
  border-color: rgba(37, 99, 235, 0.32);
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(37, 58, 113, 0.09);
}

.portal-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5 52%, #7c3aed);
  border-color: transparent;
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.24);
  animation: active-tab-pop 0.34s var(--ease-out) both;
}

.portal-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
  background: rgba(255, 255, 255, 0.82);
}

.portal-tab.active .portal-tab__mark {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.portal-tab.active .portal-tab__copy small {
  color: rgba(255, 255, 255, 0.78);
}

.employee-compose-grid {
  gap: 32px;
}

.employee-form-panel .form-grid {
  gap: 14px;
}

.employee-item-row {
  gap: 12px;
  padding: 14px;
}

.employee-live-preview {
  min-height: 330px;
  padding: 28px;
}

.contributor-kpi-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.78fr);
  gap: 18px;
  margin-bottom: 22px;
}

.contributor-kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  grid-column: 1 / -1;
}

.kpi-card,
.contributor-chart-panel {
  position: relative;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
  border: 1px solid rgba(207, 220, 237, 0.92);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(31, 49, 91, 0.075);
}

.kpi-card {
  min-height: 132px;
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 18px;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  font-weight: 800;
}

.kpi-card strong {
  color: #172554;
  font-size: 2.05rem;
  line-height: 1;
}

.contributor-chart-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.contributor-scope-panel {
  align-content: start;
}

.contributor-chart-panel h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.contributor-chart-content {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.kpi-donut {
  width: 148px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 18px rgba(255, 255, 255, 0.78), 0 14px 34px rgba(37, 58, 113, 0.1);
}

.kpi-donut span,
.kpi-donut small {
  grid-area: 1 / 1;
}

.kpi-donut span {
  margin-top: -10px;
  color: #172554;
  font-size: 1.8rem;
  font-weight: 900;
}

.kpi-donut small {
  margin-top: 34px;
  color: var(--muted);
  font-weight: 800;
}

.kpi-bars {
  display: grid;
  gap: 12px;
}

.kpi-bar-row {
  display: grid;
  gap: 7px;
}

.kpi-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.kpi-bar-label strong {
  color: var(--text);
}

.kpi-bar-track {
  height: 10px;
  overflow: hidden;
  background: #e8eff9;
  border-radius: 999px;
}

.kpi-bar-track i {
  display: block;
  min-width: 4px;
  height: 100%;
  border-radius: inherit;
}

.activity-bars {
  min-height: 184px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.activity-bar {
  min-width: 0;
  height: 168px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  font-weight: 800;
}

.activity-bar i {
  width: 100%;
  max-width: 34px;
  align-self: end;
  display: block;
  min-height: 14px;
  background: linear-gradient(180deg, #7c3aed, #2563eb);
  border-radius: 999px 999px 8px 8px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
}

.activity-bar strong {
  color: #172554;
}

.scope-split-chart {
  display: grid;
  gap: 16px;
}

.scope-meter {
  height: 18px;
  display: flex;
  overflow: hidden;
  background: #e8eff9;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.scope-meter i {
  display: block;
  min-width: 0;
  height: 100%;
}

.scope-meter__word {
  background: linear-gradient(90deg, #2563eb, #4f46e5);
}

.scope-meter__level {
  background: linear-gradient(90deg, #0f766e, #14b8a6);
}

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

.scope-split-grid > div,
.kpi-insight {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: rgba(248, 251, 255, 0.78);
  border: 1px solid rgba(207, 220, 237, 0.82);
  border-radius: 16px;
}

.scope-split-grid span,
.scope-split-grid small,
.kpi-insight span {
  color: var(--muted);
  font-weight: 800;
}

.scope-split-grid strong {
  color: #172554;
  font-size: 1.6rem;
  line-height: 1;
}

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

.kpi-insight {
  min-height: 78px;
}

.kpi-insight strong {
  color: #172554;
  font-size: 1.16rem;
  line-height: 1.25;
}

.auth-card {
  color: var(--text);
}

.auth-card h1 {
  color: var(--text) !important;
}

.auth-card .eyebrow {
  color: var(--accent) !important;
}

@keyframes portal-sheen {
  0%,
  58% {
    transform: translateX(0) rotate(24deg);
  }
  78%,
  100% {
    transform: translateX(360%) rotate(24deg);
  }
}

@keyframes active-tab-pop {
  from {
    transform: translateY(2px) scale(0.98);
  }
  to {
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 1440px) {
  .contributor-kpi-dashboard {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr) minmax(320px, 0.78fr);
  }

  .contributor-kpi-cards {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .admin-body .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar .workspace-nav::before {
    display: none;
  }

  .nav-btn {
    grid-template-columns: none;
  }

  .builder-mid-row,
  .contributor-kpi-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .admin-body .app-layout {
    padding: 14px;
  }

  .portal-topbar {
    min-height: auto;
    padding: 24px 20px;
  }

  .employee-body .portal-topbar {
    top: 10px;
  }

  .employee-body .portal-tabs {
    top: auto;
  }

  .portal-tabs {
    width: 100%;
    border-radius: 22px;
  }

  .portal-tab {
    min-width: 0;
  }

  .contributor-chart-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .scope-split-grid,
  .kpi-insights {
    grid-template-columns: 1fr;
  }

  .contributor-kpi-cards {
    grid-template-columns: 1fr;
  }

  .activity-bars {
    gap: 6px;
  }
}

.employee-body .portal-topbar {
  top: 0;
}

.employee-body .portal-topbar::before {
  display: none;
}

.employee-body .portal-topbar h1,
.employee-body .portal-topbar .eyebrow,
.employee-body .portal-topbar .meta-note {
  color: var(--text);
}

.employee-body .portal-topbar .eyebrow {
  color: var(--accent);
}

.employee-body .portal-topbar .secondary-btn {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-color: transparent;
}

@media (max-width: 760px) {
  .employee-body .portal-layout {
    padding: 0 14px 14px;
  }

  .employee-body .portal-topbar {
    top: 0;
    margin-inline: -14px;
    padding: 10px 14px;
    border-radius: 0;
  }

  .portal-tabs {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-block: 16px 22px;
    border-radius: 22px;
  }

  .portal-tabs__context {
    min-height: auto;
  }

  .portal-tabs__items {
    grid-template-columns: 1fr;
  }

  .portal-tab {
    min-height: 68px;
  }
}

/* ── Final contributor navigation and analytics cleanup ───────────── */
.employee-body .portal-layout {
  padding: 0 28px 32px;
  gap: 0;
}

.employee-body .portal-topbar {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.portal-title-block {
  display: grid;
  gap: 0;
}

.portal-title-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.employee-body .portal-layout > .portal-tabs {
  width: min(520px, 100%);
  max-width: calc(100vw - 56px);
  margin: 18px auto 34px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(191, 207, 232, 0.92);
  border-radius: 18px;
  box-shadow:
    0 16px 38px rgba(37, 58, 113, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.employee-body .portal-layout > .portal-tabs .portal-tab {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  color: #475569;
  background: transparent;
  border: 0;
  border-radius: 13px;
  box-shadow: none;
  text-decoration: none;
  transform: none;
}

.employee-body .portal-layout > .portal-tabs .portal-tab::after {
  display: none;
}

.portal-tab__icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 9px;
  font-weight: 900;
}

.portal-tab__label {
  font-weight: 900;
  white-space: nowrap;
}

.employee-body .portal-layout > .portal-tabs .portal-tab:hover {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.employee-body .portal-layout > .portal-tabs .portal-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6d28d9);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
  animation: active-tab-pop 0.24s var(--ease-out) both;
}

.employee-body .portal-layout > .portal-tabs .portal-tab.active .portal-tab__icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.employee-body .employee-view {
  width: min(1540px, 100%);
  margin-inline: auto;
}

#employeeContributionsView .contributor-kpi-dashboard {
  margin-bottom: 38px;
}

.contributor-analytics-toggle-row {
  display: flex;
  justify-content: flex-start;
  margin: -4px 0 16px;
}

.contributor-analytics-toggle-row .secondary-btn {
  min-height: 38px;
  border-color: rgba(126, 157, 207, 0.52);
  background: rgba(248, 251, 255, 0.9);
}

.contributor-kpi-dashboard.is-collapsed {
  display: none !important;
}

#employeeKpiDashboard.is-collapsed + .filter-toolbar {
  margin-top: 18px;
}

#employeeContributionsView .filter-toolbar {
  margin: 38px 0 24px;
}

.contributor-chart-panel {
  padding: 24px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94));
  box-shadow:
    0 22px 54px rgba(31, 49, 91, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.contributor-chart-content {
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 24px;
}

.kpi-donut {
  position: relative;
  width: 178px;
  box-shadow:
    inset 0 0 0 22px rgba(255, 255, 255, 0.84),
    0 18px 42px rgba(37, 58, 113, 0.13);
}

.kpi-donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 0 0 1px rgba(207, 220, 237, 0.8);
}

.kpi-donut span,
.kpi-donut small {
  position: relative;
  z-index: 1;
}

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

.distribution-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 247, 255, 0.86));
  border: 1px solid rgba(207, 220, 237, 0.9);
  border-radius: 18px;
}

.distribution-card__head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.distribution-card__head span {
  color: #334155;
  font-weight: 900;
}

.distribution-card__head strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--dist-color);
  background: #eef5ff;
  border-radius: 12px;
  font-size: 1.08rem;
}

.distribution-card__track {
  height: 10px;
  overflow: hidden;
  background: #e6eef9;
  border-radius: 999px;
}

.distribution-card__track i {
  display: block;
  min-width: 4px;
  height: 100%;
  background: var(--dist-color);
  border-radius: inherit;
}

.distribution-card small {
  color: var(--muted);
  font-weight: 800;
}

.scope-meter {
  height: 22px;
}

.activity-bars {
  padding: 16px;
  background: rgba(248, 251, 255, 0.9);
  border: 1px solid rgba(207, 220, 237, 0.8);
  border-radius: 20px;
}

.activity-bar i {
  width: 28px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
}

@media (max-width: 760px) {
  .employee-body .portal-layout {
    padding: 0 14px 20px;
  }

  .employee-body .portal-topbar {
    gap: 10px;
    flex-wrap: wrap;
  }

  .portal-title-note {
    display: none;
  }

  .employee-body .portal-layout > .portal-tabs {
    max-width: 100%;
    margin-block: 14px 24px;
  }

  .contributor-chart-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ── Final requested portal header, tabs, and input styling ───────── */
.employee-body .portal-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  border-bottom: 1px solid rgba(199, 213, 235, 0.92);
  box-shadow: 0 12px 32px rgba(31, 49, 91, 0.08);
}

.employee-body .portal-topbar::after {
  height: 2px;
  background: linear-gradient(90deg, #2563eb 0%, #7c3aed 48%, #0f766e 100%);
  opacity: 0.85;
}

.employee-body .portal-topbar h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(1.2rem, 1rem + 0.55vw, 1.55rem);
  font-weight: 900;
  line-height: 1.25;
}

.employee-body .portal-topbar .eyebrow {
  margin: 0 0 2px;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 900;
}

.employee-body .portal-topbar .portal-title-note {
  color: #64748b;
  font-size: 0.84rem;
}

.employee-body .portal-topbar .button-row {
  padding: 5px;
  background: #f1f6ff;
  border: 1px solid rgba(199, 213, 235, 0.95);
  border-radius: 14px;
}

.employee-body .portal-topbar .secondary-btn {
  min-height: 38px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6d28d9);
  border: 0;
  border-radius: 11px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.employee-body .portal-layout > .portal-tabs {
  width: fit-content;
  min-width: 340px;
  max-width: calc(100vw - 56px);
  margin: 18px 0 16px auto;
  padding: 5px;
  display: inline-flex;
  justify-content: flex-start;
  gap: 4px;
  background: #ffffff;
  border: 1px solid rgba(199, 213, 235, 0.92);
  border-radius: 15px;
  box-shadow: 0 14px 34px rgba(31, 49, 91, 0.08);
}

.employee-preview-panel {
  padding: 24px;
}

.employee-preview-panel .employee-live-preview {
  min-height: 420px;
}

.employee-body .portal-layout > .portal-tabs .portal-tab {
  min-height: 40px;
  min-width: 150px;
  padding: 8px 18px;
  color: #475569;
  background: transparent;
  border: 0;
  border-radius: 11px;
  box-shadow: none;
  font-weight: 900;
}

.employee-body .portal-layout > .portal-tabs .portal-tab__icon,
.employee-body .portal-layout > .portal-tabs .portal-tab__mark {
  display: none !important;
}

.employee-body .portal-layout > .portal-tabs .portal-tab:hover {
  color: #2563eb;
  background: #f1f6ff;
}

.employee-body .portal-layout > .portal-tabs .portal-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6d28d9);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.employee-body .field-block input:not([type="checkbox"]):not([type="radio"]),
.employee-body .field-block textarea,
.employee-body .field-block select,
.employee-body .filter-toolbar input,
.employee-body .filter-toolbar select,
.employee-body .auth-form input {
  min-height: 50px;
  padding: 12px 15px;
  color: #111827;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #c8d7ec;
  border-radius: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 8px 18px rgba(31, 49, 91, 0.045);
}

.employee-body .field-block textarea {
  min-height: 132px;
}

.employee-body .field-block input:not([type="checkbox"]):not([type="radio"]):focus-visible,
.employee-body .field-block textarea:focus-visible,
.employee-body .field-block select:focus-visible,
.employee-body .filter-toolbar input:focus-visible,
.employee-body .filter-toolbar select:focus-visible {
  border-color: #2563eb;
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.12),
    0 14px 30px rgba(37, 99, 235, 0.08);
}

@media (max-width: 760px) {
  .employee-body .portal-topbar {
    padding: 10px 14px;
  }

  .employee-body .portal-layout > .portal-tabs {
    width: 100%;
    min-width: 0;
    margin: 14px 0 24px;
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab {
    min-width: 0;
    flex: 1;
  }
}

/* ── Select arrows and tab alignment refinement ───────────────────── */
.employee-body .field-block select,
.employee-body .filter-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-start: 46px !important;
  background-image:
    url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%2364758b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: left 16px center, 0 0;
  background-size: 18px 18px, auto;
}

.employee-body .field-block select:focus-visible,
.employee-body .filter-toolbar select:focus-visible {
  background-image:
    url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5' stroke='%232563eb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
}

.employee-body[data-employee-view="new"] .portal-layout > .portal-tabs {
  width: min(748px, calc(100vw - 56px));
  margin-left: auto;
  margin-right: 0;
}

.employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
  width: min(100%, 1540px);
  margin-inline: auto;
  justify-content: flex-start;
}

.employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs .portal-tab {
  flex: 0 0 170px;
}

@media (max-width: 1180px) {
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    width: 100%;
  }

  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs .portal-tab {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .employee-body .field-block select,
  .employee-body .filter-toolbar select {
    padding-inline-start: 42px !important;
    background-position: left 13px center, 0 0;
  }
}

/* ── Final fix: centered stable tabs and select icon spacing only ──── */
.employee-body .portal-layout > .portal-tabs,
.employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
.employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
  width: min(420px, calc(100vw - 56px));
  min-width: 0;
  margin: 34px auto 28px !important;
  padding: 5px;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(199, 213, 235, 0.92);
  border-radius: 15px;
  box-shadow: 0 12px 30px rgba(31, 49, 91, 0.07);
}

.employee-body .portal-layout > .portal-tabs .portal-tab,
.employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs .portal-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 8px 14px;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  box-shadow: none;
  transform: none !important;
  animation: none !important;
  transition: background-color 0.16s var(--ease-soft), color 0.16s var(--ease-soft), border-color 0.16s var(--ease-soft);
}

.employee-body .portal-layout > .portal-tabs .portal-tab:hover,
.employee-body .portal-layout > .portal-tabs .portal-tab:focus-visible {
  color: #2563eb;
  background: #f1f6ff;
  border-color: rgba(37, 99, 235, 0.14);
  box-shadow: none;
  outline: none;
}

.employee-body .portal-layout > .portal-tabs .portal-tab.active,
.employee-body .portal-layout > .portal-tabs .portal-tab[aria-current="page"] {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #6d28d9);
  border-color: transparent;
  box-shadow: none;
  transform: none !important;
  animation: none !important;
}

.employee-body .portal-layout > .portal-tabs .portal-tab.active:active,
.employee-body .portal-layout > .portal-tabs .portal-tab:active {
  transform: none !important;
}

.employee-body .portal-layout > .portal-tabs .portal-tab__label {
  display: block;
  text-align: center;
}

.employee-body .field-block select,
.employee-body .filter-toolbar select {
  padding-right: 15px !important;
  padding-left: 46px !important;
  padding-inline-start: 15px !important;
  padding-inline-end: 46px !important;
  background-position: left 16px center, 0 0 !important;
  background-repeat: no-repeat, no-repeat !important;
  background-size: 18px 18px, auto !important;
  transition: border-color 0.16s var(--ease-soft), box-shadow 0.16s var(--ease-soft), background-color 0.16s var(--ease-soft);
}

.employee-body .field-block select:focus,
.employee-body .filter-toolbar select:focus {
  outline: none;
}

.employee-body .field-block select:focus-visible,
.employee-body .filter-toolbar select:focus-visible {
  padding-right: 15px !important;
  padding-left: 46px !important;
  padding-inline-start: 15px !important;
  padding-inline-end: 46px !important;
  background-position: left 16px center, 0 0 !important;
  background-repeat: no-repeat, no-repeat !important;
  background-size: 18px 18px, auto !important;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.employee-body .employee-preview-panel {
  top: 104px;
}

@media (max-width: 760px) {
  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    width: 100%;
    margin: 24px auto 22px !important;
  }

  .employee-body .field-block select,
  .employee-body .filter-toolbar select,
  .employee-body .field-block select:focus-visible,
  .employee-body .filter-toolbar select:focus-visible {
    padding-left: 42px !important;
    background-position: left 13px center, 0 0 !important;
    background-repeat: no-repeat, no-repeat !important;
  }

  .employee-body .employee-preview-panel {
    top: auto;
  }
}

/* ── Cleaner contributor analytics redesign ───────────────────────── */
#employeeContributionsView .contributor-kpi-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin: 0 0 34px;
}

#employeeContributionsView .contributor-kpi-cards {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

#employeeContributionsView .kpi-card {
  min-height: 112px;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.9));
  border: 1px solid rgba(205, 219, 239, 0.9);
  box-shadow: 0 14px 34px rgba(31, 49, 91, 0.065);
}

#employeeContributionsView .kpi-card strong {
  font-size: 1.75rem;
}

#employeeContributionsView .contributor-chart-panel {
  min-height: 318px;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 92% 8%, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94));
  border: 1px solid rgba(205, 219, 239, 0.9);
  box-shadow: 0 18px 44px rgba(31, 49, 91, 0.075);
}

#employeeContributionsView .contributor-performance-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

#employeeContributionsView .performance-chart-content {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

#employeeContributionsView .kpi-donut {
  width: 138px;
  aspect-ratio: 1;
  box-shadow:
    inset 0 0 0 18px rgba(255, 255, 255, 0.84),
    0 16px 34px rgba(37, 58, 113, 0.12);
}

#employeeContributionsView .kpi-donut::after {
  inset: 28px;
}

#employeeContributionsView .kpi-donut span {
  font-size: 1.55rem;
}

#employeeContributionsView .kpi-bars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

#employeeContributionsView .distribution-card {
  display: grid;
  grid-template-columns: minmax(128px, 0.7fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(205, 219, 239, 0.8);
  box-shadow: none;
}

#employeeContributionsView .distribution-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#employeeContributionsView .distribution-card__head span {
  font-size: 0.9rem;
}

#employeeContributionsView .distribution-card__head strong {
  width: 30px;
  height: 30px;
  font-size: 0.98rem;
}

#employeeContributionsView .distribution-card__track {
  height: 9px;
}

#employeeContributionsView .distribution-card small {
  white-space: nowrap;
  font-size: 0.78rem;
}

#employeeContributionsView .scope-split-chart {
  margin-top: 18px;
  gap: 12px;
}

#employeeContributionsView .scope-meter {
  height: 16px;
}

#employeeContributionsView .scope-split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#employeeContributionsView .scope-split-grid > div {
  min-height: 86px;
  padding: 13px;
  border-radius: 16px;
  box-shadow: none;
}

#employeeContributionsView .contributor-activity-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

#employeeContributionsView .activity-bars {
  min-height: 174px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.88);
}

#employeeContributionsView .activity-bar {
  height: 146px;
}

#employeeContributionsView .kpi-insights {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#employeeContributionsView .kpi-insight {
  min-height: 64px;
  padding: 11px 12px;
  border-radius: 14px;
  box-shadow: none;
}

#employeeContributionsView .filter-toolbar {
  margin-top: 34px;
}

@media (max-width: 1180px) {
  #employeeContributionsView .contributor-kpi-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #employeeContributionsView .contributor-kpi-cards,
  #employeeContributionsView .scope-split-grid,
  #employeeContributionsView .kpi-insights {
    grid-template-columns: 1fr;
  }

  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  #employeeContributionsView .distribution-card {
    grid-template-columns: 1fr;
  }
}

/* ── Simple page signature footer ────────────────────────────────── */
.admin-body,
.employee-body,
.auth-body {
  padding-bottom: 0;
}

.signature-footer {
  position: static;
  z-index: 5;
  width: min(100%, 360px);
  max-width: calc(100% - 32px);
  min-height: 0;
  margin: 18px auto 26px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
  padding: 14px 12px 0;
  direction: ltr;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  font-family: "Cairo", "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: center;
}

.signature-footer::before {
  content: "";
  display: block;
  width: 96px;
  height: 1px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.48), transparent);
}

.signature-footer span {
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: lowercase;
}

.signature-footer strong {
  direction: rtl;
  color: #2563eb;
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-body .app-layout {
  padding-bottom: 34px;
}

.employee-body .portal-layout {
  padding-bottom: 34px;
}

.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-body .auth-shell {
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  width: min(460px, 100%);
}

@media (max-width: 760px) {
  .signature-footer {
    margin: 12px auto 18px;
    max-width: calc(100vw - 24px);
    min-height: 30px;
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  .admin-body .app-layout,
  .employee-body .portal-layout {
    padding-bottom: 22px;
  }

  .auth-body .auth-shell {
    margin-bottom: 0;
  }
}

/* ── Mobile app experience layer ─────────────────────────────────── */
@media (max-width: 760px) {
  html {
    scroll-padding-top: 76px;
  }

  .admin-body,
  .employee-body,
  .auth-body {
    overflow-x: hidden;
    padding-bottom: 92px;
  }

  .panel,
  .auth-card {
    border-radius: 18px;
  }

  .panel {
    padding: 16px;
  }

  .panel-head {
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .panel-head h2 {
    font-size: 1.08rem;
    line-height: 1.35;
  }

  .meta-note {
    font-size: 0.82rem;
    line-height: 1.65;
  }

  .button-row,
  .panel-footer-actions {
    width: 100%;
    gap: 8px;
  }

  .button-row > *,
  .panel-footer-actions > * {
    min-width: 0;
  }

  .primary-btn,
  .secondary-btn {
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 12px;
  }

  .field-block,
  .filter-field {
    gap: 8px;
  }

  .field-block label,
  .filter-label,
  .auth-form label > span {
    font-size: 0.86rem;
  }

  .field-block input:not([type="checkbox"]):not([type="radio"]),
  .field-block textarea,
  .field-block select,
  .filter-toolbar input,
  .filter-toolbar select,
  .auth-form input,
  .shared-count-field input,
  .upload-options-grid input,
  .upload-options-grid select,
  .input-stretch {
    min-height: 46px;
    padding: 11px 13px;
    border-radius: 13px;
    font-size: 0.94rem;
  }

  .field-block textarea,
  .filter-toolbar textarea {
    min-height: 118px;
  }

  .field-block input:not([type="checkbox"]):not([type="radio"]):focus-visible,
  .field-block textarea:focus-visible,
  .field-block select:focus-visible,
  .filter-toolbar input:focus-visible,
  .filter-toolbar select:focus-visible,
  .auth-form input:focus-visible {
    box-shadow:
      0 0 0 3px rgba(37, 99, 235, 0.12),
      0 12px 24px rgba(37, 99, 235, 0.08);
  }

  .filter-toolbar,
  .form-grid,
  .builder-top-row,
  .builder-target-row,
  .builder-mid-row,
  .metadata-grid,
  .results-grid,
  .upload-options-grid,
  .approved-hints-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .filter-toolbar {
    padding: 12px;
    border-radius: 16px;
  }

  .bank-card,
  .group-card,
  .level-card,
  .employee-item-row {
    border-radius: 16px;
  }

  .bank-card__head,
  .group-card__head,
  .level-card__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .bank-card__preview {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .admin-body .app-layout {
    grid-template-columns: 1fr !important;
    gap: 14px;
    padding: 10px 10px 96px;
  }

  .admin-body .sidebar {
    position: sticky;
    top: 0;
    z-index: 90;
    display: grid;
    gap: 8px;
    min-height: auto;
    padding: 8px 0 10px;
    background:
      linear-gradient(180deg, rgba(238, 245, 255, 0.98) 0%, rgba(238, 245, 255, 0.88) 74%, rgba(238, 245, 255, 0) 100%);
    backdrop-filter: blur(18px);
  }

  .sidebar .brand-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px 12px;
    min-height: 58px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .sidebar .brand-card::after,
  .sidebar .workspace-nav::before,
  .sidebar .brand-subtitle,
  .sidebar .brand-card .eyebrow {
    display: none;
  }

  .sidebar .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    transform: none;
  }

  .sidebar .brand-card h1 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.35;
  }

  .sidebar .workspace-nav {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border-radius: 18px;
  }

  .sidebar .workspace-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 116px;
    min-height: 42px;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 13px;
    text-align: center;
  }

  .sidebar .nav-btn__icon {
    width: 28px;
    height: 28px;
    margin: 0;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  .sidebar .nav-btn span:not(.nav-btn__icon) {
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .sidebar .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  .sidebar .sidebar-footer .secondary-btn {
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
  }

  .main-content,
  .workspace-page,
  .builder-page-grid,
  .cards-bank-list,
  .group-list,
  .level-list {
    min-width: 0;
  }

  .word-list,
  .cards-bank-list,
  .group-list,
  .level-list,
  .admin-table-wrap {
    overflow-x: auto;
  }

  .employee-body .portal-layout {
    max-width: none;
    padding: 0 12px 96px;
    gap: 0;
  }

  .employee-body .portal-topbar {
    min-height: 62px;
    margin-inline: -12px;
    padding: 8px 12px;
    gap: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .employee-body .portal-topbar::after {
    height: 2px;
  }

  .employee-body .portal-topbar h1 {
    font-size: 1.08rem;
    line-height: 1.25;
  }

  .employee-body .portal-topbar .eyebrow {
    display: none;
  }

  .employee-body .portal-topbar .button-row {
    width: auto;
    padding: 3px;
    gap: 5px;
    border-radius: 12px;
  }

  .employee-body .portal-topbar .meta-note {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
  }

  .employee-body .portal-topbar .secondary-btn {
    width: auto;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    width: 100%;
    max-width: 430px;
    margin: 14px auto 16px !important;
    padding: 4px;
    border-radius: 14px;
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs .portal-tab {
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 10px;
    font-size: 0.88rem;
  }

  .employee-view {
    min-width: 0;
  }

  .employee-compose-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
    direction: rtl;
  }

  .employee-form-panel,
  .employee-preview-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .employee-preview-panel {
    order: -1;
    position: static !important;
    padding: 12px;
  }

  .employee-preview-panel .employee-live-preview,
  .employee-live-preview {
    min-height: 176px;
    padding: 16px;
    border-radius: 16px;
  }

  .employee-live-preview .preview-title {
    font-size: 0.95rem;
  }

  .items-preview,
  .equation-preview {
    gap: 8px;
  }

  .preview-item {
    min-width: 38px;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 12px;
  }

  .employee-form-panel .form-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .employee-form-panel .panel-head {
    margin-bottom: 14px;
  }

  .employee-item-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }

  .employee-item-row select,
  .employee-item-row input {
    grid-column: 1 / -1;
  }

  .employee-item-row .drag-handle {
    width: 34px;
    height: 34px;
  }

  .employee-item-row .small-btn {
    width: auto;
    min-height: 34px;
    padding: 7px 10px;
  }

  #employeeContributionsView .panel {
    padding: 14px;
  }

  #employeeContributionsView .contributor-kpi-dashboard {
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 22px;
  }

  #employeeContributionsView .contributor-kpi-cards {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #employeeContributionsView .kpi-card {
    min-height: 86px;
    padding: 14px;
    border-radius: 17px;
  }

  #employeeContributionsView .kpi-card strong {
    font-size: 1.45rem;
  }

  #employeeContributionsView .contributor-chart-panel {
    min-height: auto;
    padding: 16px;
    border-radius: 18px;
  }

  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 1fr;
    gap: 16px;
    justify-items: center;
  }

  #employeeContributionsView .kpi-donut {
    width: 124px;
  }

  #employeeContributionsView .distribution-card {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 11px 12px;
    border-radius: 14px;
  }

  #employeeContributionsView .scope-split-grid,
  #employeeContributionsView .kpi-insights {
    grid-template-columns: 1fr !important;
  }

  #employeeContributionsView .activity-bars {
    min-height: 132px;
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 7px;
    padding: 12px 8px;
    border-radius: 16px;
  }

  #employeeContributionsView .activity-bar {
    height: 112px;
  }

  #employeeContributionsView .filter-toolbar {
    margin-top: 22px;
  }

  .auth-body {
    padding: 14px 12px 18px;
  }

  .auth-shell {
    min-height: calc(100dvh - 110px);
    padding: 0;
  }

  .auth-card {
    width: 100%;
    padding: 20px;
  }

  .auth-card h1 {
    font-size: 1.25rem;
    line-height: 1.35;
  }

  .signature-footer {
    position: static;
    inset: auto;
    max-width: calc(100vw - 20px);
    min-height: 0;
    margin: 12px auto 18px;
    padding: 12px 8px 0;
    gap: 1px;
    pointer-events: auto;
  }

  .signature-footer::before {
    display: block;
  }

  .signature-footer span {
    font-size: 0.68rem;
  }

  .signature-footer strong {
    font-size: 0.84rem;
  }
}

@media (max-width: 360px) {
  .employee-body .portal-topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
    min-height: 96px;
  }

  .employee-body .portal-topbar .button-row {
    justify-content: space-between;
  }

  .employee-body .portal-topbar .meta-note {
    max-width: none;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    max-width: none;
  }
}

@media (max-width: 430px) {
  .sidebar .brand-card h1 {
    font-size: 0.94rem;
  }

  .sidebar .nav-btn {
    min-width: 104px;
  }
}

/* ── Final mobile refinement: compact header, charts, footer ─────── */
@media (max-width: 760px) {
  .employee-body .portal-topbar {
    min-height: 58px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
  }

  .employee-body .portal-title-block {
    min-width: 0;
    padding-inline: 74px;
    text-align: center;
  }

  .employee-body .portal-topbar h1 {
    font-size: 1.08rem;
    line-height: 1.25;
  }

  .employee-body .portal-topbar .eyebrow {
    display: none !important;
  }

  .employee-body .portal-topbar .button-row {
    position: absolute;
    left: 12px;
    top: 50%;
    width: auto;
    padding: 0;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .employee-body .portal-topbar .meta-note {
    display: none;
  }

  .employee-body .portal-topbar .secondary-btn {
    width: auto;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 11px;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    margin-top: 12px !important;
  }

  #employeeContributionsView .contributor-kpi-dashboard {
    gap: 14px;
    margin-bottom: 18px;
  }

  #employeeContributionsView .contributor-kpi-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  #employeeContributionsView .kpi-card {
    min-height: 78px;
    padding: 11px 9px;
    border-radius: 15px;
  }

  #employeeContributionsView .kpi-card strong {
    font-size: 1.24rem;
    line-height: 1.1;
  }

  #employeeContributionsView .kpi-card span,
  #employeeContributionsView .kpi-card small {
    font-size: 0.72rem;
    line-height: 1.45;
  }

  #employeeContributionsView .contributor-chart-panel {
    padding: 14px;
    border-radius: 17px;
  }

  #employeeContributionsView .contributor-chart-panel h3 {
    font-size: 0.98rem;
  }

  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    justify-items: stretch;
  }

  #employeeContributionsView .kpi-donut {
    width: 98px;
  }

  #employeeContributionsView .kpi-donut::after {
    inset: 21px;
  }

  #employeeContributionsView .kpi-donut span {
    font-size: 1.1rem;
  }

  #employeeContributionsView .kpi-bars {
    gap: 8px;
  }

  #employeeContributionsView .distribution-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 13px;
  }

  #employeeContributionsView .distribution-card__head {
    min-width: 0;
  }

  #employeeContributionsView .distribution-card__head span {
    font-size: 0.78rem;
  }

  #employeeContributionsView .distribution-card__head strong {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
  }

  #employeeContributionsView .distribution-card__track {
    grid-column: 1 / -1;
    height: 7px;
  }

  #employeeContributionsView .distribution-card small {
    display: none;
  }

  #employeeContributionsView .scope-split-chart {
    margin-top: 12px;
    gap: 8px;
  }

  #employeeContributionsView .scope-meter {
    height: 12px;
  }

  #employeeContributionsView .scope-split-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  #employeeContributionsView .scope-split-grid > div {
    min-height: 66px;
    padding: 9px;
    border-radius: 13px;
  }

  #employeeContributionsView .activity-bars {
    min-height: 104px;
    padding: 10px 8px;
  }

  #employeeContributionsView .activity-bar {
    height: 88px;
  }

  #employeeContributionsView .kpi-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  #employeeContributionsView .kpi-insight {
    min-height: 54px;
    padding: 9px;
  }

  .signature-footer {
    width: min(100%, 260px);
    margin: 14px auto 18px;
    text-align: center;
  }
}

@media (max-width: 380px) {
  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  #employeeContributionsView .kpi-bars {
    width: 100%;
  }
}

/* ── Employee profile page ───────────────────────────────────────── */
.employee-profile-panel {
  width: min(1120px, 100%);
  margin-inline: auto;
}

.employee-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.profile-card {
  padding: 22px;
  border: 1px solid rgba(199, 213, 235, 0.9);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
  box-shadow: 0 18px 44px rgba(31, 49, 91, 0.065);
}

.profile-card__head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(199, 213, 235, 0.8);
}

.profile-card__head h3 {
  margin: 0;
  color: #172033;
  font-size: 1.08rem;
  font-weight: 900;
}

.profile-card .status-box {
  grid-column: 1 / -1;
  margin-top: 0;
}

.employee-profile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  color: #2563eb !important;
  text-decoration: none;
  border-radius: 999px;
  transition: background-color 0.16s var(--ease-soft), color 0.16s var(--ease-soft);
}

.employee-profile-link:hover,
.employee-profile-link:focus-visible {
  color: #6d28d9 !important;
  background: rgba(37, 99, 235, 0.08);
  outline: none;
}

.employee-body[data-employee-view="contributions"] .contributions-list {
  max-height: none;
  overflow: visible;
  padding: 2px 0;
}

.readiness-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.readiness-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 20%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-strong) 10%, var(--surface-3)), color-mix(in srgb, var(--accent) 6%, var(--surface-2)));
  display: grid;
  gap: 4px;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent-strong) 8%, transparent);
}

.readiness-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.readiness-item strong {
  color: var(--text);
}

.readiness-item.ok {
  border-color: color-mix(in srgb, var(--success) 42%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--success) 13%, var(--surface-3)), color-mix(in srgb, var(--accent) 7%, var(--surface-2)));
}

.readiness-item.warn {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--warning) 14%, var(--surface-3)), color-mix(in srgb, var(--accent-strong) 5%, var(--surface-2)));
}

.readiness-item.error {
  border-color: color-mix(in srgb, var(--danger) 44%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 14%, var(--surface-3)), color-mix(in srgb, var(--accent-strong) 5%, var(--surface-2)));
}

.employee-body[data-employee-view="contributions"] .contributions-list .bank-card {
  transform: none !important;
  transition:
    border-color 0.16s var(--ease-soft),
    box-shadow 0.16s var(--ease-soft),
    background-color 0.16s var(--ease-soft);
}

.employee-body[data-employee-view="contributions"] .contributions-list .bank-card:hover {
  transform: none !important;
}

@media (max-width: 900px) {
  .employee-profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .employee-profile-panel {
    padding: 14px;
  }

  .employee-profile-grid {
    gap: 12px;
  }

  .profile-card {
    padding: 15px;
    border-radius: 17px;
  }

  .profile-card__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .profile-card__head h3 {
    font-size: 1rem;
  }

  .employee-body .portal-topbar .button-row {
    position: static;
    display: contents;
    width: auto;
    padding: 0;
    transform: none;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .employee-body .portal-topbar .employee-profile-link {
    position: absolute;
    right: 12px;
    top: 50%;
    z-index: 2;
    display: inline-flex !important;
    max-width: 92px;
    min-height: 34px;
    padding: 7px 10px;
    overflow: hidden;
    color: #2563eb !important;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(199, 213, 235, 0.85);
    box-shadow: 0 8px 18px rgba(31, 49, 91, 0.08);
    transform: translateY(-50%);
  }

  .employee-body .portal-topbar .employee-profile-link span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .employee-body .portal-topbar .secondary-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
  }
}

@media (max-width: 380px) {
  .employee-body .portal-topbar .employee-profile-link {
    max-width: 78px;
    padding-inline: 8px;
  }
}

/* Contributor live preview: mirror the in-game notebook hint card. */
.employee-body .employee-preview-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(205, 219, 239, 0.84);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.88));
  box-shadow: 0 18px 42px rgba(31, 49, 91, 0.08);
}

.employee-body .employee-preview-panel::before {
  content: "معاينة مباشرة";
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0;
  color: #111827;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
}

.employee-body .employee-live-preview {
  position: relative;
  isolation: isolate;
  min-height: 360px;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  align-content: stretch;
  justify-items: stretch;
  gap: 14px;
  overflow: hidden;
  padding: 28px 34px;
  color: #263042;
  border: 1px solid rgba(199, 210, 254, 0.72);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  --preview-line-height: 32px;
  --preview-content-offset: 48px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 30px rgba(31, 49, 91, 0.07);
}

.employee-body .employee-preview-panel .employee-live-preview {
  min-height: 380px;
}

.employee-body .employee-live-preview::before {
  display: none;
}

.employee-body .employee-live-preview > * {
  position: relative;
  z-index: 1;
}

.employee-body .employee-live-preview .employee-preview-title {
  justify-self: center;
  min-height: var(--preview-line-height);
  margin: 0;
  padding: 0;
  color: #312e81;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: var(--preview-line-height);
  text-align: center;
}

.employee-body .employee-live-preview .preview-text {
  display: grid;
  place-items: center;
  justify-self: center;
  align-self: stretch;
  margin: 0;
  padding: 0;
  width: 100%;
  color: #1e293b;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: var(--preview-line-height);
  text-align: center;
  white-space: pre-wrap;
  box-shadow: none;
}

.employee-body .employee-live-preview .editor-empty {
  display: grid;
  place-items: center;
  justify-self: center;
  align-self: stretch;
  margin: 0;
  padding: 0;
  width: 100%;
  color: #667085;
  background: transparent;
  border: 0;
  border-radius: 0;
  line-height: var(--preview-line-height);
  text-align: center;
  box-shadow: none;
}

.employee-body .employee-live-preview .employee-preview-answer {
  position: absolute;
  left: 14px;
  bottom: 8px;
  z-index: 2;
  margin: 0;
  padding: 4px 8px;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(199, 210, 254, 0.72);
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.6;
  opacity: 0.72;
  text-align: left;
  direction: rtl;
}

.employee-body .employee-live-preview .employee-preview-words {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(199, 210, 254, 0.6);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(31, 49, 91, 0.05);
}

.employee-body .employee-live-preview .employee-preview-words > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.employee-body .employee-live-preview .employee-preview-words span {
  color: #172033;
  background: rgba(238, 242, 255, 0.86);
  border: 1px solid rgba(199, 210, 254, 0.8);
  border-radius: 999px;
  box-shadow: none;
}

.employee-body .employee-live-preview .preview-item,
.employee-body .employee-live-preview .equation-placeholder {
  display: inline;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #172033;
  background: transparent;
  border: 0;
  border-radius: 0;
  line-height: inherit;
  vertical-align: baseline;
  box-shadow: none;
}

.employee-body .employee-live-preview .equation-preview .preview-item {
  font-size: 1.18em;
}

.employee-body .employee-live-preview .equation-preview {
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: var(--preview-line-height);
  margin: var(--preview-content-offset) 0 0;
  padding: 0;
  color: #172033;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: clamp(1.35rem, 2.2vw, 2.1rem);
  font-weight: 900;
  line-height: var(--preview-line-height);
  box-shadow: none;
}

.employee-body .employee-live-preview .equation-op {
  color: #4f46e5;
  line-height: var(--preview-line-height);
  text-shadow: none;
}

.employee-body .employee-live-preview .preview-image-grid {
  display: grid;
  grid-template-columns: repeat(var(--preview-image-columns, 1), minmax(0, 1fr));
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 12px;
  width: 100%;
  margin-top: var(--preview-content-offset);
  overflow: visible;
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.employee-body .employee-live-preview.is-image-preview {
  justify-items: center;
}

.employee-body .employee-live-preview.is-single-image-preview {
  align-content: center;
}

.employee-body .employee-live-preview .preview-image-grid.is-single {
  justify-self: center;
  align-self: center;
  width: 100%;
  min-height: 0;
  margin-top: 0;
  padding: 0;
}

.employee-body .employee-live-preview .preview-image-grid.is-single .preview-image {
  width: auto;
  min-height: 0;
  max-width: 100%;
}

.employee-body .employee-live-preview .preview-image {
  display: inline-grid;
  place-items: center;
  width: auto;
  height: auto;
  max-width: 100%;
  overflow: visible;
}

.employee-body .employee-live-preview .preview-image img,
.employee-body .employee-live-preview .preview-item img {
  width: auto;
  height: auto;
  max-width: min(300px, 100%);
  max-height: 260px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body .employee-live-preview .preview-image-grid.is-multi .preview-image img {
  max-width: min(128px, 100%);
  max-height: 128px;
}

.employee-body .employee-live-preview .preview-image-grid.is-multi {
  width: min(100%, var(--preview-image-grid-width, 408px));
}

.employee-body .employee-live-preview .preview-image-grid.is-multi .preview-image {
  width: 100%;
  height: auto;
  max-width: 128px;
  max-height: 128px;
  aspect-ratio: auto;
  overflow: visible;
}

.employee-body .employee-live-preview .equation-preview .preview-item img {
  width: auto;
  height: 1.35em;
  max-width: 1.8em;
  max-height: 1.35em;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  vertical-align: -0.18em;
}

@media (max-width: 760px) {
  .employee-body .employee-live-preview,
  .employee-body .employee-preview-panel .employee-live-preview {
    min-height: 280px;
    padding: 22px;
  }

  .employee-body .employee-live-preview::before {
    display: none;
  }

  .employee-body .employee-preview-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .employee-body .employee-live-preview .preview-text {
    font-size: 1.05rem;
  }

  .employee-body .employee-live-preview .employee-preview-answer {
    left: 12px;
    bottom: 8px;
  }
}

/* ── Final mobile chart anti-overlap pass ────────────────────────── */
@media (max-width: 760px) {
  #employeeContributionsView .contributor-kpi-dashboard {
    gap: 12px;
  }

  #employeeContributionsView .contributor-kpi-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  #employeeContributionsView .contributor-kpi-cards .kpi-card:first-child {
    grid-column: 1 / -1;
  }

  #employeeContributionsView .kpi-card {
    min-width: 0;
    min-height: 92px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 12px;
    overflow: hidden;
  }

  #employeeContributionsView .kpi-card span,
  #employeeContributionsView .kpi-card strong,
  #employeeContributionsView .kpi-card small {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: start;
  }

  #employeeContributionsView .kpi-card span {
    font-size: 0.78rem;
  }

  #employeeContributionsView .kpi-card strong {
    font-size: 1.38rem;
  }

  #employeeContributionsView .kpi-card small {
    font-size: 0.74rem;
    line-height: 1.5;
  }

  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 1fr !important;
    justify-items: center;
    gap: 14px;
  }

  #employeeContributionsView .kpi-bars {
    width: 100%;
  }

  #employeeContributionsView .distribution-card {
    grid-template-columns: minmax(0, 1fr) auto;
    overflow: hidden;
  }

  #employeeContributionsView .distribution-card__head {
    min-width: 0;
  }

  #employeeContributionsView .distribution-card__head span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #employeeContributionsView .scope-split-grid > div,
  #employeeContributionsView .kpi-insight {
    min-width: 0;
    overflow: hidden;
  }

  #employeeContributionsView .activity-bars {
    overflow: hidden;
  }

  #employeeContributionsView .activity-bar {
    min-width: 0;
  }

  #employeeContributionsView .activity-bar span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
  }
}

@media (max-width: 420px) {
  #employeeContributionsView .contributor-chart-panel {
    padding: 12px;
  }

  #employeeContributionsView .scope-split-grid,
  #employeeContributionsView .kpi-insights {
    grid-template-columns: 1fr !important;
  }
}

/* ── Contributor analytics range controls and final chart polish ───── */
#employeeContributionsView .contributor-kpi-dashboard {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  align-items: stretch;
}

#employeeContributionsView .contributor-range-toolbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(205, 219, 239, 0.9);
  border-radius: 18px;
  background: rgba(248, 251, 255, 0.88);
}

#employeeContributionsView .range-mode-tabs,
#employeeContributionsView .range-navigation,
#employeeContributionsView .custom-range-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#employeeContributionsView .range-mode-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(205, 219, 239, 0.95);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

#employeeContributionsView .range-mode-btn.active {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.34);
  background: rgba(37, 99, 235, 0.1);
}

#employeeContributionsView .range-navigation {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  justify-content: stretch;
  align-items: center;
  gap: 10px;
}

#employeeContributionsView .range-navigation strong {
  min-width: 0;
  color: #172554;
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: start;
}

#employeeContributionsView .range-step-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#employeeContributionsView .range-today-btn {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(79, 70, 229, 0.32);
  border-radius: 999px;
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.1);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.08);
}

#employeeContributionsView .range-today-btn:disabled,
#employeeContributionsView .range-step-actions .secondary-btn:disabled {
  color: rgba(96, 112, 134, 0.56);
  border-color: rgba(205, 219, 239, 0.72);
  background: rgba(241, 245, 249, 0.68);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.78;
}

#employeeContributionsView .range-input-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(205, 219, 239, 0.86);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

#employeeContributionsView .range-input-field span {
  padding-inline: 2px;
}

#employeeContributionsView .range-month-picker {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(92px, 0.55fr);
  gap: 8px;
}

#employeeContributionsView .range-input-field input:not([type="hidden"]),
#employeeContributionsView .range-input-field select {
  min-width: 0;
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid rgba(196, 208, 224, 0.9);
  border-radius: 12px;
  color: #172554;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  font: inherit;
  font-weight: 900;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

#employeeContributionsView .range-input-field input:not([type="hidden"]):focus,
#employeeContributionsView .range-input-field select:focus {
  border-color: rgba(79, 70, 229, 0.62);
  box-shadow:
    0 0 0 3px rgba(79, 70, 229, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#employeeContributionsView .contributor-kpi-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

#employeeContributionsView .kpi-card {
  min-height: 104px;
  border-radius: 16px;
}

#employeeContributionsView .kpi-card strong {
  font-size: 1.42rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#employeeContributionsView .performance-chart-content {
  grid-template-columns: 148px minmax(0, 1fr) !important;
}

#employeeContributionsView .kpi-donut {
  width: 148px;
  position: relative;
}

#employeeContributionsView .kpi-donut span,
#employeeContributionsView .kpi-donut small {
  position: relative;
  z-index: 1;
}

#employeeContributionsView .kpi-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

#employeeContributionsView .distribution-group {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-self: stretch;
  padding: 12px;
  border: 1px solid rgba(205, 219, 239, 0.88);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.74));
}

#employeeContributionsView .distribution-group--word {
  box-shadow: inset 4px 0 0 rgba(15, 118, 110, 0.22);
}

#employeeContributionsView .distribution-group--level {
  box-shadow: inset 4px 0 0 rgba(79, 70, 229, 0.22);
}

#employeeContributionsView .distribution-group__head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#employeeContributionsView .distribution-group__head h4 {
  margin: 0;
  color: #172554;
  font-size: 0.98rem;
  line-height: 1.35;
}

#employeeContributionsView .distribution-group__head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

#employeeContributionsView .distribution-group__head > strong {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #172554;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(205, 219, 239, 0.9);
  border-radius: 14px;
  font-size: 1.1rem;
  line-height: 1;
}

#employeeContributionsView .distribution-group__head > strong small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
}

#employeeContributionsView .distribution-group__items {
  display: grid;
  gap: 8px;
}

#employeeContributionsView .distribution-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(205, 219, 239, 0.86);
}

#employeeContributionsView .distribution-card__head {
  min-width: 0;
  display: contents;
}

#employeeContributionsView .distribution-card__head span {
  min-width: 0;
  color: #334155;
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 900;
  overflow-wrap: anywhere;
}

#employeeContributionsView .distribution-card__head strong {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--dist-color);
  background: rgba(248, 251, 255, 0.98);
  border-radius: 10px;
  font-size: 0.94rem;
}

#employeeContributionsView .distribution-card__track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eef9;
}

#employeeContributionsView .distribution-card__track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--dist-color);
}

#employeeContributionsView .distribution-card small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

#employeeContributionsView .scope-split-chart {
  margin-top: 16px;
}

#employeeContributionsView .scope-meter {
  height: 14px;
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eef9;
}

#employeeContributionsView .scope-meter i {
  min-width: 0;
}

#employeeContributionsView .scope-split-grid > div {
  min-height: 74px;
  border-radius: 14px;
}

#employeeContributionsView .activity-bars {
  min-height: 184px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(58px, 1fr);
  gap: 9px;
  align-items: end;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 14px;
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.9);
}

#employeeContributionsView .activity-bar {
  min-width: 0;
  height: 154px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 6px;
  justify-items: center;
  color: var(--muted);
  font-weight: 900;
}

#employeeContributionsView .activity-bar i {
  width: min(28px, 70%);
  align-self: end;
  display: block;
  min-height: 10px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, #2563eb, #0f766e);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

#employeeContributionsView .activity-bar.is-future {
  opacity: 0.5;
}

#employeeContributionsView .activity-bar span,
#employeeContributionsView .activity-bar small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

#employeeContributionsView .activity-bar small {
  font-size: 0.68rem;
  color: var(--muted);
}

#employeeContributionsView .kpi-insights {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#employeeContributionsView .kpi-insight {
  min-height: 72px;
  border-radius: 14px;
}

#employeeContributionsView .kpi-insight span {
  line-height: 1.55;
}

.employee-body .balance-guidance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-color: rgba(37, 99, 235, 0.24);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.94), rgba(240, 253, 250, 0.84));
}

.employee-body .balance-guidance.hidden {
  display: none;
}

.employee-body .balance-guidance strong,
.employee-body .balance-guidance span,
.employee-body .balance-guidance small {
  display: block;
}

.employee-body .balance-guidance__content {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.employee-body .balance-guidance strong {
  color: #172554;
  font-size: 0.92rem;
  line-height: 1.35;
}

.employee-body .balance-guidance span {
  color: #334155;
  font-size: 0.84rem;
  line-height: 1.55;
  font-weight: 800;
}

.employee-body .balance-guidance small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
  font-weight: 800;
}

.employee-body .balance-guidance.is-match {
  border-color: rgba(15, 118, 110, 0.28);
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.94), rgba(236, 253, 245, 0.86));
}

.employee-body .balance-guidance.is-needed {
  border-color: rgba(180, 83, 9, 0.26);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(239, 246, 255, 0.82));
}

.employee-body .balance-guidance.is-error {
  border-color: rgba(190, 18, 60, 0.26);
  background: rgba(255, 241, 242, 0.9);
}

.employee-body .balance-quick-select {
  min-height: 36px;
  padding-inline: 12px;
  white-space: nowrap;
}

.employee-body .balance-quick-select:disabled {
  cursor: default;
  opacity: 0.7;
}

#employeeContributionsView .global-balance-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(205, 219, 239, 0.86);
}

#employeeContributionsView .global-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#employeeContributionsView .global-balance-head strong,
#employeeContributionsView .global-balance-head span,
#employeeContributionsView .global-balance-head mark {
  display: block;
}

#employeeContributionsView .global-balance-head strong {
  color: #172554;
  font-size: 0.98rem;
  line-height: 1.35;
}

#employeeContributionsView .global-balance-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

#employeeContributionsView .global-balance-head mark {
  max-width: 240px;
  padding: 8px 10px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 12px;
  color: #0f766e;
  background: rgba(240, 253, 250, 0.92);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.45;
}

#employeeContributionsView .global-balance-scopes,
#employeeContributionsView .global-balance-slots {
  display: grid;
  gap: 8px;
}

#employeeContributionsView .global-balance-scopes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#employeeContributionsView .global-balance-scope {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(205, 219, 239, 0.84);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

#employeeContributionsView .global-balance-scope strong,
#employeeContributionsView .global-balance-slot strong {
  display: block;
  color: #334155;
  font-size: 0.84rem;
  line-height: 1.4;
}

#employeeContributionsView .global-balance-scope span,
#employeeContributionsView .global-balance-slot span,
#employeeContributionsView .global-balance-slot small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  font-weight: 800;
}

#employeeContributionsView .global-balance-scope i {
  position: relative;
  width: 100%;
  height: 8px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #e6eef9;
}

#employeeContributionsView .global-balance-scope i::before {
  content: "";
  width: var(--scope-width, 0%);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0f766e);
}

#employeeContributionsView .global-balance-slots {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#employeeContributionsView .global-balance-slot {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(205, 219, 239, 0.84);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

#employeeContributionsView .global-balance-slot.is-recommended {
  border-color: rgba(15, 118, 110, 0.36);
  background: rgba(240, 253, 250, 0.92);
}

#employeeContributionsView .global-balance-slot.is-low small {
  color: #b45309;
}

#employeeContributionsView .global-balance-slot.is-balanced small {
  color: #0f766e;
}

#employeeContributionsView .global-balance-slot.is-high small {
  color: #be123c;
}

#employeeContributionsView .balance-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(248, 251, 255, 0.86);
  font-size: 0.82rem;
  font-weight: 800;
}

@media (max-width: 1180px) {
  #employeeContributionsView .contributor-kpi-dashboard,
  #employeeContributionsView .contributor-range-toolbar {
    grid-template-columns: 1fr;
  }

  #employeeContributionsView .range-navigation {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .employee-body .balance-guidance {
    grid-template-columns: 1fr;
  }

  .employee-body .balance-quick-select {
    justify-self: start;
  }

  #employeeContributionsView .contributor-range-toolbar {
    padding: 12px;
    border-radius: 16px;
  }

  #employeeContributionsView .range-mode-tabs,
  #employeeContributionsView .custom-range-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  #employeeContributionsView .range-navigation {
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  #employeeContributionsView .range-navigation strong {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: start;
  }

  #employeeContributionsView .range-today-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #employeeContributionsView .range-step-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    width: 100%;
  }

  #employeeContributionsView .custom-range-fields {
    grid-template-columns: 1fr 1fr;
  }

  #employeeContributionsView .range-month-picker {
    grid-template-columns: minmax(0, 1fr) minmax(86px, 0.55fr);
  }

  #employeeContributionsView .contributor-kpi-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #employeeContributionsView .performance-chart-content {
    grid-template-columns: 1fr !important;
  }

  #employeeContributionsView .kpi-bars {
    grid-template-columns: 1fr;
  }

  #employeeContributionsView .global-balance-head,
  #employeeContributionsView .global-balance-scopes,
  #employeeContributionsView .global-balance-slots {
    grid-template-columns: 1fr;
  }

  #employeeContributionsView .global-balance-head {
    display: grid;
  }

  #employeeContributionsView .global-balance-head mark {
    max-width: none;
  }

  #employeeContributionsView .kpi-donut {
    width: 126px;
  }

  #employeeContributionsView .activity-bars {
    grid-auto-columns: minmax(46px, 1fr);
    min-height: 148px;
    padding: 12px 8px;
  }

  #employeeContributionsView .activity-bar {
    height: 120px;
  }
}

@media (max-width: 420px) {
  #employeeContributionsView .range-mode-tabs,
  #employeeContributionsView .range-step-actions,
  #employeeContributionsView .custom-range-fields,
  #employeeContributionsView .range-month-picker,
  #employeeContributionsView .contributor-kpi-cards,
  #employeeContributionsView .kpi-insights {
    grid-template-columns: 1fr !important;
  }
}

/* ── Final employee input surface polish ───────────────────────────── */
.employee-body .field-block {
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(205, 219, 239, 0.78);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.employee-body .field-block label,
.employee-body .field-header label,
.employee-body .range-input-field > span {
  color: #334155;
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 900;
}

.employee-body .field-block label {
  margin-bottom: 3px;
}

.employee-body .field-header {
  margin-bottom: 3px;
}

.employee-body .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.employee-body .field-block textarea,
.employee-body .field-block select,
.employee-body .filter-toolbar input,
.employee-body .filter-toolbar select,
.employee-body .auth-form input {
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid rgba(187, 204, 226, 0.92);
  border-radius: 13px;
  color: #102033;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(15, 23, 42, 0.025);
  transition:
    border-color 0.16s var(--ease-soft),
    box-shadow 0.16s var(--ease-soft),
    background-color 0.16s var(--ease-soft),
    transform 0.16s var(--ease-soft);
}

.employee-body .field-block textarea {
  min-height: 118px;
  line-height: 1.75;
}

.employee-body #employeeTextPayloadInput {
  min-height: 78px;
  height: 78px;
  max-height: 132px;
  line-height: 1.65;
}

.employee-body #employeeLevelWordsInput {
  min-height: 132px;
  height: 132px;
  max-height: 230px;
  line-height: 1.65;
}

.employee-body .employee-form-panel {
  padding: 18px;
}

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

.employee-body .employee-form-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}

.employee-body .employee-puzzle-prompt-tools .employee-preview-menu {
  min-width: min(270px, calc(100vw - 34px));
}

.employee-body .employee-form-panel .panel-head h2 {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #102033;
  font-size: 1.18rem;
  line-height: 1.35;
  font-weight: 900;
  transform: translateY(4px);
}

.employee-body .employee-form-panel .panel-head h2::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

.employee-body .employee-form-panel .panel-head .meta-note {
  font-size: 0.82rem;
  line-height: 1.5;
}

.employee-body[data-employee-view="new"] .portal-topbar {
  margin-bottom: 12px;
}

.employee-body[data-employee-view="new"] .portal-layout > .portal-tabs {
  margin-top: 18px !important;
  margin-bottom: 16px !important;
}

.employee-body .field-block input::placeholder,
.employee-body .field-block textarea::placeholder,
.employee-body .filter-toolbar input::placeholder,
.employee-body .auth-form input::placeholder {
  color: #8a98ad;
  font-weight: 700;
}

.employee-body .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
.employee-body .field-block textarea:hover,
.employee-body .field-block select:hover,
.employee-body .filter-toolbar input:hover,
.employee-body .filter-toolbar select:hover,
.employee-body .auth-form input:hover {
  border-color: rgba(109, 132, 166, 0.75);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 5px 14px rgba(31, 49, 91, 0.045);
}

.employee-body .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus-visible,
.employee-body .field-block textarea:focus-visible,
.employee-body .field-block select:focus-visible,
.employee-body .filter-toolbar input:focus-visible,
.employee-body .filter-toolbar select:focus-visible,
.employee-body .auth-form input:focus-visible {
  outline: none;
  border-color: rgba(79, 70, 229, 0.72);
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(79, 70, 229, 0.13),
    0 8px 20px rgba(79, 70, 229, 0.07);
}

.employee-body .field-block input[readonly] {
  color: #64748b;
  background: rgba(241, 245, 249, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.employee-body .field-block select,
.employee-body .filter-toolbar select {
  border-radius: 14px;
}

@media (max-width: 760px) {
  .employee-body .field-block {
    padding: 11px;
    border-radius: 14px;
  }

  .employee-body .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .employee-body .field-block textarea,
  .employee-body .field-block select,
  .employee-body .filter-toolbar input,
  .employee-body .filter-toolbar select {
    min-height: 48px;
    padding-block: 11px;
  }
}

.employee-body[data-employee-view="contributions"] .contributions-list {
  gap: 16px;
}

.employee-body[data-employee-view="contributions"] .search-with-emoji {
  position: relative;
  flex: 1 1 280px;
  min-width: 0;
}

.employee-body[data-employee-view="contributions"] .search-with-emoji input {
  width: 100%;
  padding-inline-end: 44px;
}

.employee-body[data-employee-view="contributions"] .search-emoji-btn {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(226, 232, 240, 0.72);
  cursor: pointer;
  font-size: 1.05rem;
}

.employee-body[data-employee-view="contributions"] .search-emoji-btn:hover {
  background: rgba(203, 213, 225, 0.86);
}

.employee-body[data-employee-view="contributions"] .contributions-results-count {
  margin: 10px 0 14px;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 900;
}

.employee-body[data-employee-view="contributions"] .contributions-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 4px;
  color: #52647a;
}

.employee-body[data-employee-view="contributions"] .contributions-page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.employee-body[data-employee-view="contributions"] .contributions-page-btn {
  appearance: none;
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #52647a;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.employee-body[data-employee-view="contributions"] .contributions-page-btn:hover {
  border-color: rgba(126, 157, 207, 0.42);
  background: rgba(241, 245, 249, 0.86);
}

.employee-body[data-employee-view="contributions"] .contributions-page-btn.active {
  color: #ffffff;
  border-color: #0891b2;
  background: #0891b2;
}

.employee-body[data-employee-view="contributions"] .contributions-page-gap {
  min-width: 22px;
  color: #94a3b8;
  text-align: center;
  font-weight: 900;
}

.duplicate-warning-dialog {
  width: min(860px, calc(100% - 32px));
}

.duplicate-warning-content {
  display: grid;
  gap: 14px;
}

.duplicate-warning-summary {
  padding: 12px 14px;
  border: 1px solid rgba(217, 119, 6, 0.24);
  border-radius: 14px;
  color: #92400e;
  background: rgba(254, 243, 199, 0.72);
  font-weight: 900;
  line-height: 1.8;
}

.duplicate-match-list {
  display: grid;
  gap: 12px;
  max-height: min(64vh, 680px);
  overflow: auto;
  padding-inline-end: 4px;
}

.duplicate-match-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(184, 203, 231, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
}

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

.duplicate-puzzle-preview {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.duplicate-puzzle-preview__label {
  color: #334155;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.45;
}

.duplicate-puzzle-preview .game-live-preview-card {
  min-height: 320px;
  padding: 12px;
  border-radius: 8px;
  box-shadow: none;
}

.duplicate-puzzle-preview .game-live-preview-card.has-title {
  grid-template-rows: auto minmax(150px, 1fr) auto;
}

.duplicate-puzzle-preview .game-live-preview-card__stage {
  min-height: 150px;
  padding: 12px;
}

.duplicate-puzzle-preview .game-live-preview-card__stage .preview-image-grid {
  gap: 10px;
}

.duplicate-puzzle-preview .game-live-preview-card__stage .preview-image img,
.duplicate-puzzle-preview .game-live-preview-card__stage .preview-item img {
  max-width: min(260px, 100%);
  max-height: 190px;
}

.duplicate-puzzle-preview .game-live-preview-card__stage .preview-image-grid.is-multi .preview-image img {
  max-width: min(120px, 100%);
  max-height: 112px;
}

.duplicate-direct-preview {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 12px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 197, 94, 0.1), transparent 34%),
    linear-gradient(180deg, #e8f2ff 0%, #dceafb 100%);
}

.duplicate-direct-preview__title {
  justify-self: center;
  max-width: 100%;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}

.duplicate-direct-preview__stage {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: #182235;
  overflow: hidden;
}

.duplicate-direct-preview__stage .preview-image-grid,
.duplicate-direct-preview__stage .equation-preview,
.duplicate-direct-preview__stage .items-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.duplicate-direct-preview__stage .preview-image,
.duplicate-direct-preview__stage .preview-item,
.duplicate-match-image {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #172033;
  font: inherit;
  font-weight: 900;
}

.duplicate-direct-preview__stage .preview-image,
.duplicate-direct-preview__stage .preview-item.image-item,
.duplicate-match-image {
  cursor: zoom-in;
}

.duplicate-direct-preview__stage img,
.duplicate-match-image img {
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 78px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.duplicate-direct-preview__stage > span {
  display: block;
  max-width: 100%;
  color: #172033;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

.duplicate-direct-preview__answer {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.7;
}

.duplicate-full-details {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
}

.duplicate-full-details__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.duplicate-full-details__head strong {
  color: #172033;
  font-size: 0.92rem;
  font-weight: 900;
}

.duplicate-full-details__head span {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.45;
  text-align: end;
}

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

.duplicate-detail-row,
.duplicate-detail-block,
.duplicate-detail-media {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(203, 213, 225, 0.56);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.duplicate-detail-row small,
.duplicate-detail-block > small,
.duplicate-detail-media > small {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.45;
}

.duplicate-detail-row b,
.duplicate-detail-block > b {
  color: #172033;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.duplicate-detail-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.duplicate-detail-word-list span {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  color: #155e75;
  background: rgba(236, 254, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.duplicate-detail-text,
.duplicate-detail-empty {
  color: #172033;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.duplicate-detail-empty {
  color: #64748b;
}

.duplicate-detail-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 8px;
}

.duplicate-detail-image,
.duplicate-detail-equation .preview-item.image-item {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 70px;
  padding: 6px;
  border: 1px solid rgba(203, 213, 225, 0.68);
  border-radius: 10px;
  background: #fff;
  cursor: zoom-in;
}

.duplicate-detail-image img,
.duplicate-detail-equation .preview-item img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 92px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.duplicate-detail-equation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #172033;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.5;
}

.duplicate-match-card__head,
.duplicate-match-compare {
  display: grid;
  gap: 8px;
}

.duplicate-match-card__head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.duplicate-match-card__head strong {
  color: #111827;
  font-size: 1rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.duplicate-match-card__head span {
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

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

.duplicate-match-compare--image {
  align-items: stretch;
}

.duplicate-match-compare div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.72);
}

.duplicate-match-compare small {
  color: #64748b;
  font-weight: 800;
}

.duplicate-match-compare b {
  color: #172033;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.duplicate-match-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.duplicate-match-words span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #155e75;
  background: rgba(236, 254, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 900;
}

@media (max-width: 620px) {
  .duplicate-match-card__head,
  .duplicate-match-compare,
  .duplicate-preview-pair {
    grid-template-columns: 1fr;
  }

  .duplicate-match-card__head span {
    white-space: normal;
  }

  .duplicate-puzzle-preview .game-live-preview-card {
    min-height: 280px;
  }
}

.employee-body[data-employee-view="contributions"] .contribution-card {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-color: rgba(184, 203, 231, 0.72);
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 54%, #f2faf7 100%);
}

.employee-body[data-employee-view="contributions"] .contribution-card__main {
  display: grid;
  grid-template-columns: minmax(224px, 292px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview {
  display: grid;
  grid-template-rows: auto minmax(68px, 1fr) auto;
  gap: 7px;
  min-height: 154px;
  padding: 10px;
  border: 1px solid rgba(126, 157, 207, 0.45);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(34, 197, 94, 0.13), transparent 32%),
    linear-gradient(180deg, #e8f2ff 0%, #d9e8fb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 30px rgba(45, 74, 118, 0.1);
}

.employee-body[data-employee-view="contributions"] .contribution-type-line,
.employee-body[data-employee-view="contributions"] .contribution-card__badges,
.employee-body[data-employee-view="contributions"] .contribution-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__definition {
  justify-self: center;
  max-width: 100%;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage {
  display: grid;
  place-items: center;
  min-height: 68px;
  padding: 8px;
  border: 0;
  border-radius: 16px;
  color: #182235;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
  overflow: hidden;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 260px;
  justify-items: center;
  align-items: center;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-image,
.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-item.image-item {
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 78px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-image.compact,
.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-item {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body[data-employee-view="contributions"] .contribution-image-preview-trigger {
  appearance: none;
  cursor: zoom-in;
  font: inherit;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage img {
  width: auto;
  height: auto;
  max-width: 96px;
  max-height: 78px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.contribution-image-preview-dialog {
  width: min(860px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.contribution-image-preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.contribution-image-preview-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(70vh, 620px);
  padding: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}

.contribution-image-preview-shell img {
  width: auto;
  height: auto;
  max-width: min(760px, calc(100vw - 88px));
  max-height: min(62vh, 540px);
  object-fit: contain;
}

.contribution-image-preview-close {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  z-index: 1;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .equation-preview,
.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .items-preview {
  justify-content: center;
  gap: 8px;
  font-size: 1.28rem;
  text-align: center;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage .preview-item:not(.image-item) {
  min-width: 0;
  min-height: 0;
  justify-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body[data-employee-view="contributions"] .contribution-game-preview__stage > span {
  display: block;
  max-width: 100%;
  color: #172033;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

.employee-body[data-employee-view="contributions"] .contribution-answer-text,
.employee-body[data-employee-view="contributions"] .contribution-words {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.employee-body[data-employee-view="contributions"] .contribution-answer-text {
  justify-content: flex-start;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.7;
  text-align: start;
  overflow-wrap: anywhere;
}

.employee-body[data-employee-view="contributions"] .contribution-words span {
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid rgba(21, 128, 61, 0.2);
  border-radius: 999px;
  color: #166534;
  background: rgba(220, 252, 231, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.employee-body[data-employee-view="contributions"] .contribution-card__content {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 10px;
  min-width: 0;
  padding: 4px 0;
}

.employee-body[data-employee-view="contributions"] .contribution-card__head {
  align-items: flex-start;
  width: 100%;
}

.employee-body[data-employee-view="contributions"] .contribution-card__head strong {
  display: block;
  color: #111827;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.employee-body[data-employee-view="contributions"] .contribution-type-line {
  margin-top: 7px;
  color: #155e75;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.6;
}

.employee-body[data-employee-view="contributions"] .contribution-type-line span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-inline: 1px 8px;
  border-radius: 999px;
  background: #0891b2;
  vertical-align: middle;
}


.employee-body[data-employee-view="contributions"] .contribution-card__date {
  justify-self: end;
  display: grid;
  gap: 2px;
  margin: 0;
  color: #52647a;
  text-align: left;
  white-space: nowrap;
}

.employee-body[data-employee-view="contributions"] .contribution-card__date-value {
  direction: ltr;
  color: #7c8da3;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.employee-body[data-employee-view="contributions"] .contribution-card__relative-date {
  color: #52647a;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.35;
}

.employee-body[data-employee-view="contributions"] .contribution-card .warning-badges,
.employee-body[data-employee-view="contributions"] .contribution-card .meta-note {
  justify-self: start;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.7;
}

.employee-body[data-employee-view="contributions"] .contribution-status {
  color: #155e75;
  border-color: rgba(8, 145, 178, 0.24);
  background: rgba(236, 254, 255, 0.84);
}

.employee-body[data-employee-view="contributions"] .contribution-status--approved {
  color: #166534;
  border-color: rgba(22, 101, 52, 0.24);
  background: rgba(220, 252, 231, 0.86);
}

.employee-body[data-employee-view="contributions"] .contribution-status--rejected {
  color: #991b1b;
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(254, 226, 226, 0.88);
}

.employee-body[data-employee-view="contributions"] .contribution-status--needs_changes {
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.24);
  background: rgba(254, 243, 199, 0.9);
}

.employee-body[data-employee-view="contributions"] .contribution-card__actions {
  grid-row: 4;
  align-self: end;
  justify-content: flex-start;
  margin-top: 0;
}

@media (max-width: 920px) {
  .employee-body[data-employee-view="contributions"] .contribution-card__main {
    grid-template-columns: 1fr;
  }

  .employee-body[data-employee-view="contributions"] .contribution-game-preview {
    min-height: 154px;
  }
}

@media (max-width: 560px) {
  .employee-body[data-employee-view="contributions"] .contribution-card__main {
    padding: 12px;
  }

  .employee-body[data-employee-view="contributions"] .contribution-card__head,
  .employee-body[data-employee-view="contributions"] .contribution-card__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .employee-body[data-employee-view="contributions"] .contribution-card__badges,
  .employee-body[data-employee-view="contributions"] .contribution-card__actions {
    justify-content: stretch;
  }

  .employee-body[data-employee-view="contributions"] .contribution-card__actions > * {
    width: 100%;
  }
}

/* ── Live contributor game-card preview ─────────────────────────── */
.employee-body .employee-preview-panel::before {
  display: none;
  content: none;
}

.employee-body .employee-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
}

.employee-body .employee-preview-toolbar strong {
  min-width: 0;
  color: #172033;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.4;
}

.employee-body .employee-preview-tools {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.employee-body .employee-preview-menu-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
}

.employee-body .employee-preview-menu-btn svg {
  width: 18px;
  height: 18px;
}

.employee-body .employee-preview-menu {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 30;
  display: grid;
  min-width: min(240px, calc(100vw - 34px));
  padding: 6px;
  border: 1px solid rgba(71, 85, 105, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.employee-body .employee-preview-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  color: #172033;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: right;
}

.employee-body .employee-preview-menu button:hover,
.employee-body .employee-preview-menu button:focus-visible {
  background: #eef6ff;
  outline: 0;
}

.employee-body .employee-preview-menu svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #2563eb;
}

.employee-body .employee-live-preview,
.employee-body .employee-preview-panel .employee-live-preview {
  min-height: 350px;
  display: grid;
  grid-template-rows: 1fr;
  align-content: stretch;
  place-items: stretch;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body .employee-live-preview.is-image-preview,
.employee-body .employee-live-preview.is-single-image-preview {
  align-content: stretch;
  justify-items: stretch;
}

.employee-body .game-live-preview-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(124px, 1fr) auto;
  gap: 10px;
  min-width: 0;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(71, 85, 105, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 16% 12%, rgba(34, 197, 94, 0.14), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(245, 158, 11, 0.13), transparent 28%),
    linear-gradient(180deg, #eaf3ff 0%, #dceaf6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 16px 34px rgba(31, 49, 91, 0.09);
}

.employee-body .game-live-preview-card.has-title {
  grid-template-rows: auto minmax(124px, 1fr) auto;
}

.employee-body .game-live-preview-card__head {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.employee-body .game-live-preview-card__head span {
  padding: 3px 8px;
  border: 1px solid rgba(8, 145, 178, 0.2);
  border-radius: 999px;
  color: #155e75;
  background: rgba(236, 254, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.35;
}

.employee-body .game-live-preview-card__head strong {
  max-width: 100%;
  color: #172033;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.employee-body .game-live-preview-card__head small {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.employee-body .game-live-preview-card__stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 124px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  color: #172033;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.employee-body .game-live-preview-card__stage .preview-text,
.employee-body .game-live-preview-card__stage .editor-empty {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 82px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.employee-body .game-live-preview-card__stage .preview-text {
  color: #182235;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.employee-body .game-live-preview-card__stage .editor-empty {
  color: #64748b;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.7;
}

.employee-body .game-live-preview-card__stage .preview-image-grid {
  display: grid;
  grid-template-columns: repeat(var(--preview-image-columns, 1), minmax(0, 1fr));
  place-items: center;
  gap: 12px;
  width: min(100%, var(--preview-image-grid-width, 408px));
  margin: 0;
  padding: 0;
  overflow: visible;
}

.employee-body .game-live-preview-card__stage .preview-image-grid.is-single {
  width: 100%;
}

.employee-body .game-live-preview-card__stage .preview-image,
.employee-body .game-live-preview-card__stage .preview-item.image-item {
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body .game-live-preview-card__stage .preview-image img,
.employee-body .game-live-preview-card__stage .preview-item img {
  width: auto;
  height: auto;
  max-width: min(320px, 100%);
  max-height: 180px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.employee-body .game-live-preview-card__stage .preview-image-grid.is-multi .preview-image img {
  max-width: min(122px, 100%);
  max-height: 116px;
}

.employee-body .game-live-preview-card__stage .equation-preview,
.employee-body .game-live-preview-card__stage .items-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #172033;
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
}

.employee-body .game-live-preview-card__stage .preview-item,
.employee-body .game-live-preview-card__stage .equation-placeholder {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
}

.employee-body .game-live-preview-card__stage .equation-op {
  color: #0f766e;
  font-weight: 900;
  line-height: 1;
}

.employee-body .game-live-preview-card__stage .equation-preview .preview-item img {
  width: auto;
  height: 1.2em;
  max-width: 1.6em;
  max-height: 1.2em;
  object-fit: contain;
  vertical-align: -0.16em;
}

.employee-body .game-answer-panel,
.employee-body .game-answer-empty {
  align-self: end;
  min-width: 0;
  border: 1px solid rgba(71, 85, 105, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.employee-body .game-answer-panel {
  display: grid;
  gap: 8px;
  padding: 9px;
}

.employee-body .game-answer-empty {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 9px;
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
}

.employee-body .game-answer-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  color: #334155;
}

.employee-body .game-answer-panel__head span {
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.4;
}

.employee-body .game-answer-panel__head strong {
  color: #166534;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.4;
  white-space: nowrap;
}

.employee-body .game-answer-word-list,
.employee-body .game-answer-level-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.employee-body .game-answer-text {
  min-width: 0;
  color: #172033;
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.7;
  text-align: right;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.employee-body .game-answer-level-list {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}

.employee-body .game-answer-level-word {
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 999px;
  color: #134e4a;
  background: rgba(240, 253, 250, 0.88);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.employee-body .puzzle-quality-panel {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(71, 85, 105, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.employee-body .puzzle-quality-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.employee-body .puzzle-quality-head span {
  min-width: 0;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.4;
}

.employee-body .puzzle-quality-head strong {
  color: #172033;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.employee-body .puzzle-quality-head em {
  padding: 3px 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.35;
  white-space: nowrap;
}

.employee-body .puzzle-quality-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.employee-body .puzzle-quality-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.employee-body .puzzle-quality-notes {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.employee-body .puzzle-quality-notes li,
.employee-body .puzzle-quality-ready {
  min-width: 0;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.employee-body .puzzle-quality-notes li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 7px;
  border-radius: 999px;
  background: #d97706;
  vertical-align: 0.04em;
}

.employee-body .puzzle-quality-notes li.is-error::before {
  background: #dc2626;
}

.employee-body .puzzle-quality-ready {
  color: #166534;
}

.employee-body .puzzle-quality-panel.is-excellent .puzzle-quality-head em {
  color: #166534;
  background: #dcfce7;
}

.employee-body .puzzle-quality-panel.is-excellent .puzzle-quality-meter i {
  background: #16a34a;
}

.employee-body .puzzle-quality-panel.is-good .puzzle-quality-head em {
  color: #1d4ed8;
  background: #dbeafe;
}

.employee-body .puzzle-quality-panel.is-good .puzzle-quality-meter i {
  background: #2563eb;
}

.employee-body .puzzle-quality-panel.is-needs-work .puzzle-quality-head em {
  color: #92400e;
  background: #fef3c7;
}

.employee-body .puzzle-quality-panel.is-needs-work .puzzle-quality-meter i {
  background: #d97706;
}

.employee-body .puzzle-quality-panel.is-weak .puzzle-quality-head em {
  color: #991b1b;
  background: #fee2e2;
}

.employee-body .puzzle-quality-panel.is-weak .puzzle-quality-meter i {
  background: #dc2626;
}

.employee-body .prompt-copy-dialog {
  width: min(720px, calc(100vw - 28px));
}

.employee-body .prompt-copy-layout {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.employee-body .prompt-copy-output {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 12px;
  border: 1px solid rgba(71, 85, 105, 0.18);
  border-radius: 8px;
  color: #172033;
  background: #f8fafc;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.7;
  text-align: right;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .employee-body .employee-preview-toolbar {
    margin-bottom: 10px;
  }

  .employee-body .employee-live-preview,
  .employee-body .employee-preview-panel .employee-live-preview {
    min-height: 310px;
    padding: 0;
  }

  .employee-body .game-live-preview-card {
    grid-template-rows: minmax(116px, 1fr) auto;
    gap: 9px;
    padding: 11px;
  }

  .employee-body .game-live-preview-card.has-title {
    grid-template-rows: auto minmax(116px, 1fr) auto;
  }

  .employee-body .game-live-preview-card__stage {
    min-height: 116px;
    padding: 11px;
  }

  .employee-body .game-live-preview-card__head strong {
    font-size: 1rem;
  }

  .employee-body .game-live-preview-card__stage .preview-text {
    font-size: 1.02rem;
  }

  .employee-body .game-live-preview-card__stage .equation-preview,
  .employee-body .game-live-preview-card__stage .items-preview {
    font-size: 1.55rem;
  }

  .employee-body .game-live-preview-card__stage .preview-image img,
  .employee-body .game-live-preview-card__stage .preview-item img {
    max-height: 130px;
  }

  .employee-body #employeeTextPayloadInput {
    min-height: 70px;
    height: 70px;
  }

  .employee-body #employeeLevelWordsInput {
    min-height: 116px;
    height: 116px;
  }

  .employee-body .prompt-copy-output {
    min-height: 220px;
  }

  .employee-body .game-answer-panel__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

}

/* ── Contributor cursor cleanup ───────────────────────────────────── */
.employee-body {
  cursor: default;
  user-select: none;
}

.employee-body :where(a, button, [role="button"], .portal-tab, .primary-btn, .secondary-btn, .icon-btn, .option-chip) {
  cursor: pointer;
}

.employee-body :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
  textarea,
  [contenteditable="true"]
) {
  cursor: text;
  user-select: text;
}

.employee-body :where(select, label[for], input[type="checkbox"], input[type="radio"], input[type="range"]) {
  cursor: default;
}

/* ── Contributor mobile workflow ─────────────────────────────────── */
.employee-body .early-similarity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 14px;
  color: #1e3a8a;
  background: rgba(239, 246, 255, 0.9);
}

.employee-body .early-similarity.hidden {
  display: none;
}

.employee-body .early-similarity__content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.employee-body .early-similarity__content strong {
  font-size: 0.92rem;
  font-weight: 900;
}

.employee-body .early-similarity__content span {
  color: #52647a;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .early-similarity.is-warning {
  border-color: rgba(217, 119, 6, 0.3);
  color: #92400e;
  background: rgba(254, 243, 199, 0.82);
}

.employee-body .drafts-list {
  display: grid;
  gap: 12px;
}

.employee-body .employee-drafts-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.employee-body .draft-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(191, 210, 235, 0.82);
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.92);
}

.employee-body .draft-card__content {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.employee-body .draft-card__content strong {
  color: #172033;
  font-weight: 900;
}

.employee-body .draft-card__content span,
.employee-body .draft-card__content small {
  color: #64748b;
  font-weight: 700;
}

.employee-body .employee-mobile-preview-btn,
.employee-body .employee-mobile-preview-close {
  display: none;
}

@media (max-width: 760px) {
  .employee-body .portal-layout > .portal-tabs {
    width: calc(100vw - 28px);
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab {
    padding-inline: 7px;
    font-size: 0.9rem;
  }

  .employee-body .draft-card {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .draft-card__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .employee-body .employee-drafts-head-actions {
    width: 100%;
  }

  .employee-body .employee-drafts-head-actions .secondary-btn {
    flex: 1 1 0;
  }
  .employee-body .early-similarity {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .early-similarity .secondary-btn {
    width: 100%;
  }

  .employee-body #employeeNewView .employee-compose-grid {
    display: flex;
    flex-direction: column;
  }

  .employee-body .employee-form-panel {
    order: 1;
  }

  .employee-body .employee-preview-panel {
    display: none;
    order: 2;
  }

  .employee-body .employee-preview-panel.is-mobile-open {
    position: fixed !important;
    inset: 0;
    z-index: 1300;
    display: block;
    width: 100%;
    height: 100dvh;
    max-height: none;
    overflow-y: auto;
    padding: 14px;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    overscroll-behavior: contain;
  }

  .employee-body.employee-mobile-preview-open {
    overflow: hidden;
  }

  .employee-body .employee-preview-panel.is-mobile-open .employee-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -2px -2px 12px;
    padding: 8px 2px 10px;
    background: rgba(248, 251, 255, 0.94);
    backdrop-filter: blur(12px);
  }

  .employee-body .employee-mobile-preview-close {
    display: inline-grid;
    place-items: center;
  }

  .employee-body .employee-preview-tools {
    gap: 8px;
  }

  .employee-body .employee-form-panel .panel-footer-actions {
    position: sticky;
    bottom: 8px;
    z-index: 25;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 8px;
    margin-top: 4px;
    padding: 8px;
    border: 1px solid rgba(191, 210, 235, 0.8);
    border-radius: 16px;
    background: rgba(248, 251, 255, 0.92);
    box-shadow: 0 12px 30px rgba(30, 64, 175, 0.14);
    backdrop-filter: blur(14px);
  }

  .employee-body .employee-mobile-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }

  .employee-body .employee-mobile-preview-btn strong {
    min-width: 36px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #dbeafe;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .employee-body .employee-mobile-preview-btn[data-quality-status="excellent"] strong {
    color: #166534;
    background: #dcfce7;
  }

  .employee-body .employee-mobile-preview-btn[data-quality-status="needs-work"] strong,
  .employee-body .employee-mobile-preview-btn[data-quality-status="weak"] strong {
    color: #92400e;
    background: #fef3c7;
  }

  .employee-body .employee-mobile-preview-btn[data-quality-status="excellent"] strong {
    color: #166534;
    background: #dcfce7;
  }

  .employee-body .employee-mobile-preview-btn[data-quality-status="needs-work"] strong,
  .employee-body .employee-mobile-preview-btn[data-quality-status="weak"] strong {
    color: #92400e;
    background: #fef3c7;
  }

  #employeeContributionsView .contributor-analytics-toggle-row {
    margin: 0 0 10px;
  }

  #employeeContributionsView .contributor-analytics-toggle-row .secondary-btn {
    width: 100%;
  }

  #employeeContributionsView #employeeKpiDashboard.is-collapsed + .filter-toolbar,
  #employeeContributionsView .filter-toolbar {
    margin: 10px 0 14px;
  }
}

/* ── Contributor local AI review ────────────────────────────────── */
.employee-body .employee-ai-review {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(238, 242, 255, 0.92), rgba(250, 245, 255, 0.9));
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.08);
}

.employee-body .employee-ai-review__head,
.employee-body .employee-ai-review__title,
.employee-body .employee-ai-review__actions,
.employee-body .employee-ai-review__summary-head {
  display: flex;
  align-items: center;
}

.employee-body .employee-ai-review__head,
.employee-body .employee-ai-review__summary-head {
  justify-content: space-between;
  gap: 12px;
}

.employee-body .employee-ai-review__title {
  gap: 10px;
  min-width: 0;
}

.employee-body .employee-ai-review__title > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.employee-body .employee-ai-review__title strong {
  color: #312e81;
  font-size: 1rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__title span,
.employee-body .employee-ai-review__intro,
.employee-body .employee-ai-review__status,
.employee-body .employee-ai-review__disclaimer {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .employee-ai-review__icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.22);
}

.employee-body .employee-ai-review__icon svg {
  width: 19px;
  height: 19px;
}

.employee-body .employee-ai-review__badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 0.72rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__intro {
  margin: 0;
  color: #475569;
}

.employee-body .employee-ai-review__actions {
  gap: 8px;
  flex-wrap: wrap;
}

.employee-body .employee-ai-review__actions .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.employee-body .employee-ai-review__progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
}

.employee-body .employee-ai-review__progress i {
  display: block;
  width: var(--ai-review-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #9333ea);
  transition: width 180ms ease;
}

.employee-body .employee-ai-review[data-status="loading"] .employee-ai-review__status,
.employee-body .employee-ai-review[data-status="reviewing"] .employee-ai-review__status {
  color: #4338ca;
}

.employee-body .employee-ai-review[data-status="error"] .employee-ai-review__status,
.employee-body .employee-ai-review[data-status="unsupported"] .employee-ai-review__status {
  color: #b45309;
}

.employee-body .employee-ai-review[data-status="complete"] .employee-ai-review__status {
  color: #15803d;
}

.employee-body .employee-ai-review[data-status="needs-change"] .employee-ai-review__status,
.employee-body .employee-ai-review[data-status="stale"] .employee-ai-review__status {
  color: #a16207;
}

.employee-body .employee-ai-review__result {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.employee-body .employee-ai-review__result.hidden {
  display: none;
}

.employee-body .employee-ai-review__result > p {
  margin: 0;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.75;
}

.employee-body .employee-ai-review__verdict,
.employee-body .employee-ai-review__score {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.employee-body .employee-ai-review__verdict.is-ready {
  color: #166534;
  background: #dcfce7;
}

.employee-body .employee-ai-review__verdict.is-revise {
  color: #92400e;
  background: #fef3c7;
}

.employee-body .employee-ai-review__verdict.is-reject {
  color: #991b1b;
  background: #fee2e2;
}

.employee-body .employee-ai-review__score {
  color: #3730a3;
  background: #e0e7ff;
}

.employee-body .employee-ai-review__group {
  display: grid;
  gap: 7px;
}

.employee-body .employee-ai-review__group > strong {
  color: #312e81;
  font-size: 0.82rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__group ul,
.employee-body .employee-ai-review__group ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-inline-start: 20px;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .employee-ai-review__group li.is-error {
  color: #b91c1c;
}

.employee-body .employee-ai-review__group li.is-warning {
  color: #a16207;
}

.employee-body .employee-ai-review__ready,
.employee-body .employee-ai-review__stale,
.employee-body .employee-ai-review__caution {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.65;
}

.employee-body .employee-ai-review__ready {
  color: #166534;
  background: #f0fdf4;
}

.employee-body .employee-ai-review__stale,
.employee-body .employee-ai-review__caution {
  color: #92400e;
  background: #fffbeb;
}

.employee-body .employee-ai-review__disclaimer {
  padding-top: 9px;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
}

@media (max-width: 760px) {
  .employee-body .employee-ai-review {
    gap: 10px;
    padding: 13px;
    border-radius: 15px;
  }

  .employee-body .employee-ai-review__head {
    align-items: flex-start;
  }

  .employee-body .employee-ai-review__title span {
    font-size: 0.74rem;
  }

  .employee-body .employee-ai-review__badge {
    font-size: 0.66rem;
  }

  .employee-body .employee-ai-review__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .employee-body .employee-ai-review__actions > * {
    width: 100%;
  }
}

/* Compact contributor review surface */
.employee-body .employee-ai-review {
  gap: 8px;
  padding: 11px 12px;
  border-color: rgba(191, 210, 235, 0.88);
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.employee-body .employee-ai-review__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.employee-body .employee-ai-review__controls .secondary-btn {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-color: rgba(99, 102, 241, 0.3);
  color: #3730a3;
  background: #eef2ff;
}

.employee-body .employee-ai-review__controls .danger-btn {
  border-color: rgba(220, 38, 38, 0.18);
  color: #b91c1c;
  background: #fff;
}

.employee-body .employee-ai-review__status {
  min-width: 0;
  flex: 1;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.55;
}

.employee-body .employee-ai-review__progress {
  height: 4px;
  margin-inline: 2px;
  background: #e2e8f0;
}

.employee-body .employee-ai-review__result {
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.employee-body .employee-ai-review__verdict {
  width: fit-content;
  padding: 0;
  border-radius: 0;
  color: #334155;
  background: transparent !important;
  font-size: 0.9rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__verdict.is-ready {
  color: #15803d;
}

.employee-body .employee-ai-review__verdict.is-revise {
  color: #a16207;
}

.employee-body .employee-ai-review__verdict.is-reject {
  color: #b91c1c;
}

.employee-body .employee-ai-review__summary {
  margin: 0;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.7;
}

.employee-body .employee-ai-review__items {
  display: grid;
  gap: 7px;
}

.employee-body .employee-ai-review__item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid #fde7c7;
  border-radius: 10px;
  background: #fffbeb;
}

.employee-body .employee-ai-review__item > span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #475569;
  background: #e2e8f0;
  font-size: 0.7rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__item.is-error > span {
  color: #991b1b;
  background: #fee2e2;
}

.employee-body .employee-ai-review__item.is-warning > span {
  color: #92400e;
  background: #fef3c7;
}

.employee-body .employee-ai-review__item > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.employee-body .employee-ai-review__item strong {
  color: #334155;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.6;
}

.employee-body .employee-ai-review__item p,
.employee-body .employee-ai-review__extras p {
  margin: 0;
  color: #64748b;
  font-size: 0.77rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .employee-ai-review__extras {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fff;
}

.employee-body .employee-ai-review__extras strong,
.employee-body .employee-ai-review__clues > strong {
  color: #3730a3;
}

.employee-body .employee-ai-review__clues {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #eef2ff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.65;
}

.employee-body .employee-ai-review__clues q {
  display: block;
  padding-inline-start: 8px;
  border-inline-start: 2px solid #a5b4fc;
  color: #475569;
}

.employee-body .employee-ai-review__ready,
.employee-body .employee-ai-review__stale {
  padding: 8px 10px;
  border-radius: 9px;
}

.employee-body .employee-ai-review__overview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid #dbe5f3;
  border-radius: 11px;
  background: #f8fafc;
}

.employee-body .employee-ai-review__rating {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-content: center;
  border-radius: 12px;
  text-align: center;
}

.employee-body .employee-ai-review__rating strong {
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
}

.employee-body .employee-ai-review__rating span {
  margin-top: 4px;
  font-size: 0.65rem;
  font-weight: 800;
}

.employee-body .employee-ai-review__rating.is-ready {
  color: #166534;
  background: #dcfce7;
}

.employee-body .employee-ai-review__rating.is-revise {
  color: #92400e;
  background: #fef3c7;
}

.employee-body .employee-ai-review__rating.is-reject {
  color: #991b1b;
  background: #fee2e2;
}

.employee-body .employee-ai-review__brief {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.employee-body .employee-ai-review__brief > strong,
.employee-body .employee-ai-review__section-title {
  color: #1e293b;
  font-size: 0.86rem;
  font-weight: 950;
}

.employee-body .employee-ai-review__brief p {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .employee-ai-review__brief small {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
}

.employee-body .employee-ai-review__taxonomy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.employee-body .employee-ai-review__taxonomy span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #dbe5f3;
  border-radius: var(--radius-xs);
  color: #334155;
  background: #ffffff;
  font-size: 0.7rem;
  font-weight: 850;
}

.employee-body .employee-ai-review__taxonomy b {
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 950;
}

.employee-body .employee-ai-review__suggestions {
  display: grid;
  gap: 7px;
}

.employee-body .employee-ai-review__clue-options,
.employee-body .employee-ai-review__clue-list {
  display: grid;
  gap: 7px;
}

.employee-body .employee-ai-review__clue-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  background: #eef2ff;
}

.employee-body .employee-ai-review__clue-option > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.employee-body .employee-ai-review__clue-option strong {
  color: #3730a3;
  font-size: 0.76rem;
  font-weight: 950;
}

.employee-body .employee-ai-review__clue-option q {
  color: #334155;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.65;
}

.employee-body .employee-ai-review__word-chip {
  width: fit-content;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  color: #115e59;
  background: #f0fdfa;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.35;
}

.employee-body .employee-ai-review__equation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: #1f2937;
  font-size: 1.05rem;
  font-weight: 950;
}

.employee-body .employee-ai-review__equation .preview-item {
  min-width: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 4px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.employee-body .employee-ai-review__clue-option .secondary-btn {
  min-height: 34px;
  white-space: nowrap;
}

.employee-body .employee-ai-review__item .secondary-btn {
  width: fit-content;
  min-height: 32px;
  margin-top: 6px;
}

.employee-body .employee-ai-review__details {
  overflow: hidden;
  border: 1px solid #dbe5f3;
  border-radius: 10px;
  background: #fff;
}

.employee-body .employee-ai-review__details summary {
  padding: 9px 11px;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.employee-body .employee-ai-review__details > div {
  display: grid;
  gap: 7px;
  padding: 0 11px 11px;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.65;
}

.employee-body .employee-ai-review__checks {
  display: grid;
  gap: 6px;
}

.employee-body .employee-ai-review__check {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #edf2f7;
}

.employee-body .employee-ai-review__check:last-child {
  border-bottom: 0;
}

.employee-body .employee-ai-review__check > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.employee-body .employee-ai-review__check.is-pass > span {
  background: #16a34a;
}

.employee-body .employee-ai-review__check.is-warning > span,
.employee-body .employee-ai-review__check.is-unknown > span {
  background: #d97706;
}

.employee-body .employee-ai-review__check.is-fail > span {
  background: #dc2626;
}

.employee-body .employee-ai-review__check > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.employee-body .employee-ai-review__check strong {
  color: #334155;
  font-size: 0.77rem;
  font-weight: 900;
}

.employee-body .employee-ai-review__check p {
  margin: 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.55;
}

.employee-body .employee-ai-review__check em {
  padding: 3px 7px;
  border-radius: 999px;
  color: #475569;
  background: #f1f5f9;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.employee-body .employee-ai-review__check.is-pass em {
  color: #166534;
  background: #dcfce7;
}

.employee-body .employee-ai-review__check.is-fail em {
  color: #991b1b;
  background: #fee2e2;
}

.employee-body .employee-ai-review__check.is-warning em,
.employee-body .employee-ai-review__check.is-unknown em {
  color: #92400e;
  background: #fef3c7;
}

.employee-body .employee-ai-review__details ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-inline-start: 18px;
}

.employee-body .employee-ai-review__player {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 90%, var(--accent-soft) 10%);
}

.employee-body .employee-ai-review__player-head,
.employee-body .employee-ai-review__player-head > div,
.employee-body .employee-ai-review__player-alternatives {
  display: flex;
  align-items: center;
  gap: 8px;
}

.employee-body .employee-ai-review__player-head {
  justify-content: space-between;
}

.employee-body .employee-ai-review__player-head svg {
  width: 18px;
  height: 18px;
  color: var(--accent-strong);
}

.employee-body .employee-ai-review__player-head > span {
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.employee-body .employee-ai-review__player.is-solved .employee-ai-review__player-head > span {
  color: var(--success);
  background: var(--success-soft);
}

.employee-body .employee-ai-review__player.is-misled .employee-ai-review__player-head > span {
  color: var(--danger);
  background: var(--danger-soft);
}

.employee-body .employee-ai-review__player-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.employee-body .employee-ai-review__player-metrics > span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px;
  border-radius: 10px;
  background: var(--surface);
}

.employee-body .employee-ai-review__player-metrics small,
.employee-body .employee-ai-review__player-alternatives small {
  color: var(--muted);
  font-size: 0.68rem;
}

.employee-body .employee-ai-review__player-metrics strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-body .employee-ai-review__player-alternatives {
  flex-wrap: wrap;
}

.employee-body .employee-ai-review__player-alternatives span {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
}

.employee-body .employee-ai-review__player p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.employee-body .employee-ai-review__safe-fix {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  background: var(--success-soft);
}

.employee-body .employee-ai-review__safe-fix > div {
  display: grid;
  gap: 2px;
}

.employee-body .employee-ai-review__safe-fix span {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 760px) {
  .employee-body .employee-ai-review__player-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body .employee-ai-review__safe-fix {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .employee-ai-review__safe-fix > button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .employee-body .employee-ai-review {
    padding: 10px;
  }

  .employee-body .employee-ai-review__controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .employee-body .employee-ai-review__controls .secondary-btn {
    width: auto;
    min-height: 40px;
  }

  .employee-body #employeeAiReviewCancelBtn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .employee-body .employee-ai-review__overview {
    align-items: flex-start;
  }

  .employee-body .employee-ai-review__rating {
    width: 54px;
    height: 54px;
  }

  .employee-body .employee-ai-review__check {
    grid-template-columns: 9px minmax(0, 1fr);
  }

  .employee-body .employee-ai-review__clue-option {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body .employee-ai-review__clue-option .secondary-btn {
    width: 100%;
  }

  .employee-body .employee-ai-review__check em {
    grid-column: 2;
    width: fit-content;
  }
}

/* Keep puzzle review inside the live-preview surface. */
.employee-body .employee-preview-panel .employee-preview-review {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
}

.employee-body .employee-preview-panel .employee-ai-review__controls {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  align-items: center;
}

.employee-body .employee-preview-panel .employee-ai-review__controls .secondary-btn {
  max-width: 100%;
  white-space: normal;
}

.employee-body .employee-preview-panel #employeeAiReviewCancelBtn {
  grid-column: 1 / -1;
  width: 100%;
}

.employee-body .employee-preview-panel .employee-ai-review__result,
.employee-body .employee-preview-panel .employee-ai-review__result > *,
.employee-body .employee-preview-panel .employee-ai-review__status {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (min-width: 1181px) {
  .employee-body .employee-preview-panel {
    max-height: calc(100dvh - 124px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 760px) {
  .employee-body .employee-preview-panel.is-mobile-open {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 10px;
    padding: 12px;
  }

  .employee-body .employee-preview-panel.is-mobile-open .employee-preview-toolbar {
    margin: -2px -2px 0;
  }

  .employee-body .employee-preview-panel .employee-live-preview,
  .employee-body .employee-preview-panel.is-mobile-open .employee-live-preview {
    min-height: clamp(245px, 42dvh, 310px);
  }

  .employee-body .employee-preview-panel .puzzle-quality-panel {
    margin-top: 0;
  }

  .employee-body .employee-preview-panel .employee-ai-review__controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body .employee-preview-panel .employee-ai-review__controls .secondary-btn,
  .employee-body .employee-preview-panel #employeeAiReviewCancelBtn {
    grid-column: 1;
    width: 100%;
  }

  .employee-body .employee-preview-panel .employee-ai-review__overview {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* ── Compact contributor workspace for small laptop screens ─────── */
.employee-body .employee-ai-image-dialog {
  max-height: calc(100dvh - 20px);
  padding: 0;
  overflow: hidden;
}

.employee-body .employee-ai-image-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.employee-body .employee-ai-image-dialog > .dialog-head {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 58px;
  margin: 0;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(205, 219, 239, 0.84);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.employee-body .employee-ai-image-dialog > .dialog-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.employee-body .employee-ai-image-dialog > .ai-generation-layout {
  min-height: 0;
  margin: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

@media (min-width: 981px) and (max-width: 1440px) {
  .employee-body .portal-layout {
    padding-inline: 16px;
    padding-bottom: 24px;
  }

  .employee-body[data-employee-view="new"] .portal-topbar {
    min-height: 56px;
    margin-inline: 0;
    margin-bottom: 0;
    padding: 7px 12px;
  }

  .employee-body .portal-topbar h1 {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .employee-body .portal-topbar .eyebrow {
    font-size: 0.62rem;
  }

  .employee-body .portal-topbar .button-row {
    padding: 3px;
  }

  .employee-body .portal-topbar .secondary-btn {
    min-height: 34px;
    padding: 7px 11px;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    width: min(390px, calc(100vw - 32px));
    margin: 9px auto 12px !important;
    padding: 4px;
    border-radius: 13px;
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs .portal-tab {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 9px;
    font-size: 0.84rem;
  }

  .employee-body #employeeNewView .employee-compose-grid {
    display: grid;
    grid-template-columns: minmax(310px, 34vw) minmax(0, 1fr) !important;
    gap: 16px;
    align-items: start;
    direction: ltr;
  }

  .employee-body #employeeNewView .employee-form-panel {
    grid-column: 2;
    grid-row: 1;
    padding: 14px;
    direction: rtl;
  }

  .employee-body #employeeNewView .employee-preview-panel {
    grid-column: 1;
    grid-row: 1;
    position: sticky !important;
    top: 10px;
    max-height: calc(100dvh - 20px);
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    direction: rtl;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .employee-body .employee-form-panel .panel-head {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .employee-body .employee-form-panel .panel-head h2 {
    font-size: 1.02rem;
  }

  .employee-body .employee-form-panel .panel-head h2::before {
    height: 20px;
  }

  .employee-body .employee-form-panel .form-grid {
    gap: 11px;
  }

  .employee-body .employee-form-panel .field-block {
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
  }

  .employee-body .employee-form-panel .field-block label,
  .employee-body .employee-form-panel .field-header label,
  .employee-body .employee-form-panel .field-label {
    margin-bottom: 0;
    font-size: 0.78rem;
  }

  .employee-body .employee-form-panel .field-header,
  .employee-body .employee-form-panel .employee-answer-field-head {
    margin-bottom: 0;
  }

  .employee-body .employee-form-panel .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .employee-body .employee-form-panel .field-block select,
  .employee-body .employee-form-panel .field-block textarea {
    min-height: 40px;
    padding-block: 7px;
    border-radius: 11px;
    font-size: 0.88rem;
  }

  .employee-body .employee-form-panel #employeeTextPayloadInput {
    min-height: 64px;
    height: 64px;
  }

  .employee-body .employee-form-panel #employeeLevelWordsInput {
    min-height: 108px;
    height: 108px;
  }

  .employee-body .employee-form-panel :is(.primary-btn, .secondary-btn) {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 0.84rem;
  }

  .employee-body .employee-form-panel .employee-title-suggestions-btn {
    min-height: 40px;
    padding-inline: 10px;
  }

  .employee-body .employee-form-panel .balance-guidance {
    gap: 8px;
    padding: 9px 10px;
  }

  .employee-body .employee-form-panel .balance-guidance__content {
    gap: 2px;
  }

  .employee-body .employee-form-panel .balance-guidance strong {
    font-size: 0.8rem;
  }

  .employee-body .employee-form-panel .balance-guidance span,
  .employee-body .employee-form-panel .balance-guidance small {
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .employee-body .employee-form-panel .employee-item-row {
    gap: 7px;
    padding: 8px;
  }

  .employee-body .employee-form-panel .image-action-stack {
    grid-template-rows: minmax(70px, auto) repeat(2, minmax(32px, auto));
    gap: 8px;
    margin-top: 20px;
    width: min(250px, 100%);
  }

  .employee-body .employee-form-panel .secondary-btn.image-upload-btn {
    min-height: 70px;
  }

  .employee-body #employeeNewView .employee-preview-toolbar {
    margin-bottom: 2px;
  }

  .employee-body #employeeNewView .employee-preview-toolbar strong {
    font-size: 0.9rem;
  }

  .employee-body #employeeNewView .employee-preview-menu-btn {
    width: 34px;
    height: 34px;
  }

  .employee-body #employeeNewView .employee-live-preview,
  .employee-body #employeeNewView .employee-preview-panel .employee-live-preview {
    min-height: 260px;
  }

  .employee-body #employeeNewView .game-live-preview-card {
    grid-template-rows: minmax(92px, 1fr) auto;
    gap: 7px;
    padding: 10px;
  }

  .employee-body #employeeNewView .game-live-preview-card.has-title {
    grid-template-rows: auto minmax(92px, 1fr) auto;
  }

  .employee-body #employeeNewView .game-live-preview-card__head {
    gap: 2px;
  }

  .employee-body #employeeNewView .game-live-preview-card__head strong {
    font-size: 1rem;
  }

  .employee-body #employeeNewView .game-live-preview-card__stage {
    min-height: 92px;
    padding: 9px;
  }

  .employee-body #employeeNewView .game-live-preview-card__stage .preview-image img,
  .employee-body #employeeNewView .game-live-preview-card__stage .preview-item img {
    max-height: 130px;
  }

  .employee-body #employeeNewView .game-answer-panel {
    gap: 5px;
    padding: 7px 8px;
  }

  .employee-body #employeeNewView .puzzle-quality-panel {
    gap: 6px;
    margin-top: 0;
    padding: 9px 10px;
  }

  .employee-body #employeeNewView .puzzle-quality-notes {
    gap: 3px;
  }

  .employee-body #employeeNewView .puzzle-quality-notes li,
  .employee-body #employeeNewView .puzzle-quality-ready {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .employee-body #employeeNewView .employee-puzzle-assistant {
    gap: 7px;
    padding: 8px 9px 9px;
  }

  .employee-body #employeeNewView .employee-preview-review {
    padding: 9px 10px;
  }

  .employee-body #employeeNewView .employee-ai-review__controls {
    gap: 7px;
  }

  .employee-body #employeeNewView .employee-ai-review__controls .secondary-btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .employee-body #employeeNewView .employee-ai-review__status {
    font-size: 0.73rem;
    line-height: 1.4;
  }

  .employee-body .employee-ai-image-dialog {
    width: min(960px, calc(100vw - 20px));
  }

  .employee-body .employee-ai-image-dialog > .dialog-head {
    min-height: 52px;
    padding: 8px 14px;
  }

  .employee-body .employee-ai-image-dialog > .ai-generation-layout {
    gap: 10px;
    padding: 10px 14px 14px;
  }

  .employee-body .employee-ai-image-dialog .ai-generation-form {
    gap: 9px;
  }

  .employee-body .employee-ai-image-dialog .ai-image-context {
    gap: 7px;
    padding: 7px 9px;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant--dialog {
    gap: 6px;
    margin-top: 0;
    padding: 7px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-selector {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 6px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option {
    min-height: 48px;
    place-content: center;
    padding: 6px 5px;
    text-align: center;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option strong {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option small {
    display: none;
  }

  .employee-body .employee-ai-image-dialog .field-block {
    gap: 5px;
    padding: 7px;
  }

  .employee-body .employee-ai-image-dialog .field-block input:not([type="checkbox"]):not([type="radio"]),
  .employee-body .employee-ai-image-dialog .field-block textarea {
    min-height: 40px;
    padding-block: 7px;
  }

  .employee-body .employee-ai-image-dialog .field-block.ai-prompt-block .ai-prompt-output {
    min-height: 52px;
    max-height: 58px;
  }

  .employee-body .employee-ai-image-dialog .ai-generator-link-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .employee-body .employee-ai-image-dialog .ai-external-btn {
    min-height: 34px;
    gap: 5px;
    padding: 7px 6px;
    font-size: 0.74rem;
  }

  .employee-body .employee-ai-image-dialog .ai-provider-icon {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__card {
    gap: 6px;
    padding: 8px;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__card p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__card .primary-btn {
    min-height: 32px;
  }
}

@media (max-width: 760px) {
  .employee-body .employee-ai-image-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .employee-body .employee-ai-image-dialog > .dialog-head {
    min-height: 54px;
    padding: 8px 10px;
  }

  .employee-body .employee-ai-image-dialog > .ai-generation-layout {
    padding: 9px 10px 12px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option {
    min-height: 64px;
    padding: 8px;
  }

  .employee-body .employee-ai-image-dialog .ai-generator-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Contributor responsive layout — final isolated layer ─────────
   Keep these rules at the end so the contributor portal has one clear source
   of truth after the older, shared admin breakpoints above. */
.employee-body .portal-layout,
.employee-body .employee-view,
.employee-body .employee-compose-grid,
.employee-body .employee-form-panel,
.employee-body .employee-preview-panel,
.employee-body .field-block,
.employee-body .employee-title-input-row,
.employee-body .employee-image-control-row,
.employee-body .employee-item-row,
.employee-body .app-dialog {
  min-width: 0;
}

.employee-body .portal-layout {
  --employee-page-gutter: 28px;
  --employee-section-title-size: 1.12rem;
  width: 100%;
  max-width: none;
  padding-top: 0;
}

.employee-body .employee-view {
  width: min(100%, 1540px);
  margin-inline: auto;
}

.employee-body #employeeNewView .employee-form-panel > .panel-head h2,
.employee-body #employeeContributionsView > .panel > .panel-head h2,
.employee-body #employeeDraftsView > .panel > .panel-head h2,
.employee-body #employeeProfileView > .panel > .panel-head h2 {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #102033;
  font-size: var(--employee-section-title-size);
  line-height: 1.35;
  font-weight: 900;
  transform: none;
}

.employee-body #employeeNewView .employee-form-panel > .panel-head h2::before,
.employee-body #employeeContributionsView > .panel > .panel-head h2::before,
.employee-body #employeeDraftsView > .panel > .panel-head h2::before,
.employee-body #employeeProfileView > .panel > .panel-head h2::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 22px;
  flex: 0 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

.employee-body .app-dialog {
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  overscroll-behavior: contain;
}

.employee-body .app-dialog > .dialog-head {
  gap: 10px;
}

.employee-body #employeeLevelWordsInput {
  max-height: none;
  overflow-y: hidden;
  resize: none;
}

body.employee-body .portal-layout > .portal-topbar {
  width: auto;
  margin-inline: calc(var(--employee-page-gutter) * -1);
  border-radius: 0;
}

@media (min-width: 981px) {
  .employee-body #employeeNewView .employee-preview-panel {
    top: var(--employee-sticky-preview-top, 72px);
    max-height: calc(100dvh - var(--employee-sticky-preview-top, 72px) - 10px);
  }
}

@media (min-width: 981px) and (max-width: 1440px) {
  .employee-body .portal-layout {
    --employee-page-gutter: 16px;
  }
}

@media (min-width: 1441px) {
  .employee-body .portal-layout {
    --employee-page-gutter: clamp(24px, 2.2vw, 36px);
    width: 100%;
    max-width: none;
    padding: 0 clamp(24px, 2.2vw, 36px) 30px;
  }

  .employee-body #employeeNewView .employee-compose-grid {
    grid-template-columns: minmax(380px, 440px) minmax(0, 1fr);
    gap: clamp(20px, 1.8vw, 30px);
    direction: ltr;
  }

  .employee-body #employeeNewView .employee-form-panel {
    grid-column: 2;
    grid-row: 1;
    direction: rtl;
  }

  .employee-body #employeeNewView .employee-preview-panel {
    grid-column: 1;
    grid-row: 1;
    overflow-y: auto;
    direction: rtl;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (min-width: 981px) and (max-height: 800px) {
  .employee-body #employeeNewView .employee-live-preview,
  .employee-body #employeeNewView .employee-preview-panel .employee-live-preview {
    min-height: 238px;
  }

  .employee-body #employeeNewView .game-live-preview-card {
    grid-template-rows: minmax(84px, 1fr) auto;
  }

  .employee-body #employeeNewView .game-live-preview-card.has-title {
    grid-template-rows: auto minmax(84px, 1fr) auto;
  }

  .employee-body #employeeNewView .game-live-preview-card__stage {
    min-height: 84px;
  }
}

/* Tablet: one focused form with preview available as a lightweight overlay. */
@media (min-width: 761px) and (max-width: 980px) {
  .employee-body {
    overflow-x: hidden;
    padding-bottom: 78px;
  }

  .employee-body .portal-layout {
    --employee-page-gutter: 14px;
    max-width: none;
    gap: 12px;
    padding: 0 14px 82px;
  }

  .employee-body .portal-topbar {
    min-height: 56px;
    padding: 8px 12px;
    border-radius: 16px;
  }

  .employee-body .portal-topbar h1 {
    font-size: 1.2rem;
  }

  .employee-body .portal-topbar .eyebrow {
    font-size: 0.62rem;
  }

  .employee-body .portal-topbar .secondary-btn {
    min-height: 36px;
    padding: 7px 11px;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    width: min(430px, 100%);
    margin: 0 auto !important;
    padding: 4px;
    border-radius: 13px;
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 9px;
    font-size: 0.86rem;
  }

  .employee-body #employeeNewView .employee-compose-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0;
    direction: rtl;
  }

  .employee-body #employeeNewView .employee-form-panel {
    grid-column: 1;
    grid-row: 1;
    padding: 14px;
  }

  .employee-body .employee-form-panel .panel-head {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

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

  .employee-body .employee-form-panel .field-block {
    gap: 7px;
    padding: 10px;
    border-radius: 13px;
  }

  .employee-body .employee-form-panel .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .employee-body .employee-form-panel .field-block select,
  .employee-body .employee-form-panel .field-block textarea {
    min-height: 44px;
    padding-block: 9px;
    border-radius: 11px;
    font-size: 0.9rem;
  }

  .employee-body .employee-form-panel #employeeTextPayloadInput {
    min-height: 76px;
    height: 76px;
  }

  .employee-body .employee-form-panel #employeeLevelWordsInput {
    min-height: 120px;
    height: 120px;
  }

  .employee-body .employee-form-panel :is(.primary-btn, .secondary-btn) {
    min-height: 40px;
    padding: 8px 11px;
  }

  .employee-body #employeeNewView .employee-preview-panel {
    display: none;
  }

  .employee-body #employeeNewView .employee-preview-panel.is-mobile-open {
    position: fixed !important;
    inset: 10px;
    z-index: 1300;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-content: start;
    gap: 10px;
    width: auto;
    height: auto;
    max-height: calc(100dvh - 20px);
    padding: 12px;
    overflow-y: auto;
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
    overscroll-behavior: contain;
  }

  .employee-body.employee-mobile-preview-open {
    overflow: hidden;
  }

  .employee-body #employeeNewView .employee-preview-panel.is-mobile-open .employee-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -2px -2px 0;
    padding: 7px 2px 9px;
    background: rgba(248, 251, 255, 0.95);
    backdrop-filter: blur(12px);
  }

  .employee-body .employee-mobile-preview-close {
    display: inline-grid;
    place-items: center;
  }

  .employee-body .employee-form-panel .panel-footer-actions {
    position: sticky;
    bottom: 8px;
    z-index: 25;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 8px;
    margin-top: 2px;
    padding: 8px;
    border: 1px solid rgba(191, 210, 235, 0.84);
    border-radius: 15px;
    background: rgba(248, 251, 255, 0.94);
    box-shadow: 0 12px 30px rgba(30, 64, 175, 0.13);
    backdrop-filter: blur(14px);
  }

  .employee-body .employee-mobile-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
  }

  .employee-body .employee-mobile-preview-btn strong {
    min-width: 38px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #dbeafe;
    font-size: 0.78rem;
    font-weight: 900;
  }

  .employee-body .employee-ai-image-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .employee-body .employee-ai-image-dialog > .dialog-head {
    min-height: 52px;
    padding: 8px 12px;
  }

  .employee-body .employee-ai-image-dialog > .ai-generation-layout {
    gap: 10px;
    padding: 10px 12px 13px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-selector,
  .employee-body .employee-ai-image-dialog .ai-generator-link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option {
    min-height: 58px;
    padding: 7px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option small {
    display: none;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phone: compact vertical form, comfortable touch targets, minimal nesting. */
@media (max-width: 760px) {
  .employee-body .portal-layout {
    --employee-page-gutter: 10px;
    --employee-section-title-size: 1rem;
    padding-inline: 10px;
    padding-bottom: 88px;
  }

  .employee-body .portal-topbar {
    min-height: 56px;
    margin-inline: -10px;
    padding: 7px 10px;
  }

  .employee-body .portal-topbar h1 {
    font-size: 1rem;
  }

  .employee-body .portal-topbar .meta-note {
    max-width: 92px;
    font-size: 0.7rem;
  }

  .employee-body .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="new"] .portal-layout > .portal-tabs,
  .employee-body[data-employee-view="contributions"] .portal-layout > .portal-tabs {
    margin: 10px auto 12px !important;
  }

  .employee-body .portal-layout > .portal-tabs .portal-tab {
    min-height: 36px;
    padding: 6px;
    font-size: 0.82rem;
  }

  .employee-body #employeeNewView .employee-form-panel,
  .employee-body .employee-view > .panel {
    padding: 10px;
    border-radius: 16px;
  }

  .employee-body .employee-form-panel .panel-head,
  .employee-body .employee-view > .panel > .panel-head {
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 9px;
  }

  .employee-body #employeeNewView .employee-form-panel > .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .employee-body #employeeNewView .employee-form-panel > .panel-head > div {
    min-width: 0;
  }

  .employee-body #employeeNewView .employee-form-panel > .panel-head h2 {
    white-space: nowrap;
  }

  .employee-body #employeeNewView #employeeResetFormBtn {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
  }

  .employee-body .employee-form-panel .panel-head h2,
  .employee-body .employee-view > .panel > .panel-head h2 {
    font-size: 1rem;
  }

  .employee-body .employee-form-panel .form-grid {
    gap: 10px;
  }

  .employee-body .employee-form-panel .field-block {
    gap: 6px;
    padding: 9px;
    border-radius: 12px;
  }

  .employee-body .employee-form-panel .field-block label,
  .employee-body .employee-form-panel .field-label {
    font-size: 0.8rem;
  }

  .employee-body .employee-form-panel .field-block input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .employee-body .employee-form-panel .field-block select,
  .employee-body .employee-form-panel .field-block textarea {
    min-height: 44px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 0.88rem;
  }

  .employee-body .employee-title-input-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .employee-body .employee-title-suggestions-btn {
    min-height: 44px;
    padding-inline: 9px;
    font-size: 0.76rem;
  }

  .employee-body .employee-title-suggestions {
    gap: 7px;
    margin-top: 7px;
    padding: 8px;
  }

  .employee-body .employee-title-suggestion {
    min-height: 40px;
    padding: 7px 9px;
    font-size: 0.82rem;
  }

  .employee-body #employeeTextPayloadInput {
    min-height: 68px;
    height: 68px;
  }

  .employee-body #employeeLevelWordsInput {
    min-height: 108px;
    height: 108px;
  }

  .employee-body .employee-image-control-row {
    gap: 9px;
  }

  .employee-body .image-action-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(58px, auto) minmax(42px, auto);
    gap: 7px;
    margin-top: 0;
  }

  .employee-body .image-action-stack .image-upload-btn {
    grid-column: 1 / -1;
    min-height: 58px;
  }

  .employee-body .image-action-stack > button {
    min-width: 0;
    padding: 8px 9px;
    white-space: normal;
    line-height: 1.4;
  }

  .employee-body .image-action-stack > button svg,
  .employee-body .image-action-stack > button i {
    position: static;
    transform: none;
  }

  .employee-body .employee-item-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    padding: 8px;
    border-radius: 12px;
  }

  .employee-body .employee-item-row select {
    grid-column: 2;
    grid-row: 1;
  }

  .employee-body .employee-item-row > input,
  .employee-body .employee-item-row > .employee-item-image-value {
    grid-column: 1 / -1;
  }

  .employee-body .employee-item-row [data-remove-item] {
    grid-column: 3;
    grid-row: 1;
  }

  .employee-body .employee-item-row [data-item-image-sources] {
    grid-column: 1 / 3;
    width: 100%;
  }

  .employee-body .employee-item-row [data-ai-item-image] {
    grid-column: 3;
    width: 100%;
  }

  .employee-body .employee-item-row .inline-op {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .employee-body .employee-items-footer .secondary-btn {
    min-height: 42px;
  }

  .employee-body .employee-preview-panel.is-mobile-open {
    padding: 10px;
  }

  .employee-body .employee-preview-panel .employee-live-preview,
  .employee-body .employee-preview-panel.is-mobile-open .employee-live-preview {
    min-height: clamp(220px, 38dvh, 280px);
  }

  .employee-body .employee-form-panel .panel-footer-actions {
    bottom: max(6px, env(safe-area-inset-bottom));
    padding: 6px;
    border-radius: 14px;
  }

  .employee-body .employee-form-panel .panel-footer-actions :is(.primary-btn, .secondary-btn) {
    min-height: 44px;
    padding: 8px 10px;
  }

  .employee-body .employee-ai-review,
  .employee-body .employee-preview-review {
    gap: 8px;
    padding: 9px;
    border-radius: 14px;
  }

  .employee-body .employee-ai-image-dialog > .ai-generation-layout {
    gap: 8px;
    padding: 8px 9px 10px;
  }

  .employee-body .employee-ai-image-dialog .ai-generation-form {
    gap: 8px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option {
    min-height: 54px;
    padding: 6px;
  }

  .employee-body .employee-ai-image-dialog .ai-template-option strong,
  .employee-body .employee-ai-image-dialog .ai-external-btn {
    font-size: 0.72rem;
  }

  .employee-body .employee-ai-image-dialog .field-block.ai-prompt-block .ai-prompt-output {
    min-height: 48px;
    max-height: 54px;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__results {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__card {
    padding: 7px;
  }

  .employee-body .employee-ai-image-dialog .employee-image-assistant__card p {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .employee-body[data-employee-view="contributions"] .filter-toolbar {
    gap: 8px;
    padding: 9px;
  }

  .employee-body[data-employee-view="contributions"] .contributions-list {
    gap: 10px;
  }

  .employee-body[data-employee-view="contributions"] .contribution-card__main {
    gap: 10px;
    padding: 10px;
  }

  .employee-body .employee-profile-grid {
    gap: 10px;
  }
}

@media (min-width: 431px) and (max-width: 760px) {
  .employee-body .employee-ai-image-dialog .ai-template-selector {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .employee-body .portal-layout {
    --employee-page-gutter: 8px;
    padding-inline: 8px;
  }

  .employee-body .portal-topbar {
    margin-inline: -8px;
  }

  .employee-body .portal-topbar .button-row {
    gap: 3px;
  }

  .employee-body .portal-topbar .secondary-btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .employee-body .employee-answer-field-head,
  .employee-body .field-header {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-body .employee-clue-tools {
    width: 100%;
  }

  .employee-body .employee-clue-tools .employee-title-suggestions-btn,
  .employee-body .employee-answer-field-head .employee-title-suggestions-btn,
  .employee-body .field-header .employee-title-suggestions-btn {
    width: 100%;
    justify-content: center;
  }

  .employee-body .employee-title-input-row .employee-title-suggestions-btn span {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .employee-body .employee-ai-image-dialog .ai-template-selector,
  .employee-body .employee-ai-image-dialog .ai-generator-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-body .employee-puzzle-assistant__drafts,
  .employee-body .employee-image-assistant__results {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-body[data-employee-view="contributions"] .contributions-pagination {
    gap: 5px;
  }

  .employee-body[data-employee-view="contributions"] .contributions-page-btn {
    min-width: 32px;
    height: 32px;
  }
}

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

/* Management cards: keep selection natural and actions anchored at the bottom. */
.contributor-management-body .management-contribution-card.is-selectable {
  cursor: pointer;
}

.contributor-management-body .management-contribution-card.is-selectable .contribution-game-preview,
.contributor-management-body .management-contribution-card.is-selectable .contribution-card__content {
  cursor: pointer;
}

.contributor-management-body .management-contribution-card .management-card-actions-row {
  grid-row: 4;
  align-self: end;
  margin-top: 0;
}

.contributor-management-body .management-contribution-card .contribution-card__actions {
  display: flex;
  flex-wrap: wrap;
}

.contributor-management-body .management-contribution-card .contribution-card__actions > * {
  width: auto;
}

/* Keep the review reference visible next to the editor on ordinary desktop screens. */
.employee-body.employee-management-edit-body #employeeNewView .employee-compose-grid {
  grid-template-columns: minmax(300px, 0.85fr) minmax(410px, 1.25fr) minmax(250px, 0.7fr) !important;
}

@media (max-width: 1120px) {
  .employee-body.employee-management-edit-body #employeeNewView .employee-compose-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr) !important;
  }
}

/* Let the searchable subject list float above neighbouring management cards. */
.employee-body.contributor-management-body[data-employee-view="contributions"] .management-contribution-card.contribution-card {
  overflow: visible;
}

.contributor-management-body .management-contribution-card:has(.management-topic-picker.is-open) {
  z-index: 30;
}

.management-card-taxonomy-editor .management-topic-picker__list {
  top: auto;
  bottom: calc(100% + 5px);
}

.management-topic-picker__list[hidden] {
  display: none !important;
}

/* Keep an equation image visually equal to its emoji neighbours, without a frame. */
.employee-body.contributor-management-body[data-employee-view="contributions"] .contribution-game-preview__stage .equation-preview .preview-item.image-item {
  display: inline-flex;
  flex: 0 0 1em;
  width: 1em;
  height: 1em;
  min-width: 1em;
  min-height: 1em;
  max-width: 1em;
  max-height: 1em;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.employee-body.contributor-management-body[data-employee-view="contributions"] .contribution-game-preview__stage .equation-preview .preview-item.image-item img,
.management-puzzle-preview-equation .management-puzzle-preview-image img {
  display: block;
  width: 1em;
  height: 1em;
  max-width: 1em;
  max-height: 1em;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.management-puzzle-preview-equation .management-puzzle-preview-image {
  display: inline-flex;
  width: 1em;
  height: 1em;
  align-items: center;
  justify-content: center;
}

/* Image lightbox: click, wheel, +/- or 0 to zoom. */
.contribution-image-preview-tools {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dce6f2;
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(31, 52, 87, 0.1);
}

.contribution-image-preview-tools output {
  min-width: 43px;
  color: #51647c;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.contribution-image-preview-canvas {
  display: grid;
  width: min(760px, calc(100vw - 88px));
  max-width: 100%;
  max-height: min(62vh, 540px);
  min-height: min(48vh, 380px);
  place-items: center;
  padding: 18px;
  overflow: auto;
  cursor: zoom-in;
}

.contribution-image-preview-canvas img {
  width: auto;
  height: auto;
  max-width: min(720px, calc(100vw - 124px));
  max-height: min(58vh, 500px);
  object-fit: contain;
  transform: scale(var(--management-image-preview-scale, 1));
  transform-origin: center;
  transition: transform 160ms ease;
}

/* Contributor-card actions: direct taxonomy controls, without an AI step. */
.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control {
  display: inline-flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 3px 7px 3px 4px;
  color: #526783;
  background: #f8fbff;
  border: 1px solid #d7e3f1;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 900;
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control > span {
  flex: 0 0 auto;
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control select,
.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control input {
  min-width: 0;
  height: 25px;
  padding: 2px 5px;
  color: #203653;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  background: #fff;
  border: 0;
  border-radius: 5px;
  outline: 0;
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control select {
  width: 72px;
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control--topic input {
  width: min(168px, 28vw);
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control--topic {
  position: relative;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker {
  position: relative;
  min-width: min(168px, 28vw);
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  overflow: hidden;
  background: #fff;
  border-radius: 5px;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__search {
  width: 100%;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__toggle {
  display: grid;
  place-items: center;
  padding: 0;
  color: #526783;
  background: #f7faff;
  border: 0;
  border-inline-start: 1px solid #d9e3f0;
  cursor: pointer;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__toggle:hover:not(:disabled) {
  color: #315cf4;
  background: #edf3ff;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__list {
  position: absolute;
  z-index: 60;
  right: 0;
  bottom: calc(100% + 6px);
  width: max(238px, 100%);
  max-height: 260px;
  padding: 5px;
  overflow: auto;
  background: #fff;
  border: 1px solid #cbd8ea;
  border-radius: 9px;
  box-shadow: 0 14px 28px rgba(31, 55, 91, 0.18);
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__list[hidden] {
  display: none !important;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__option {
  display: block;
  width: 100%;
  padding: 8px 10px;
  color: #31445f;
  text-align: right;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__option:hover,
.employee-body[data-employee-view="contributions"] .contribution-topic-picker__option:focus-visible,
.employee-body[data-employee-view="contributions"] .contribution-topic-picker__option.is-selected {
  color: #2446c9;
  background: #edf3ff;
  outline: 0;
}

.employee-body[data-employee-view="contributions"] .contribution-topic-picker__empty {
  margin: 0;
  padding: 10px;
  color: #75849a;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.employee-body[data-employee-view="contributions"] .contribution-card:has(.contribution-topic-picker.is-open) {
  position: relative;
  z-index: 20;
  overflow: visible;
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control:focus-within {
  border-color: #5b7cf5;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.12);
}

.employee-body[data-employee-view="contributions"] .contribution-card-taxonomy-control:has(:disabled) {
  opacity: 0.62;
}

@media (max-width: 760px) {
  .employee-body[data-employee-view="contributions"] .contribution-topic-picker {
    width: 100%;
  }
}
