.institution-page {
  --page-bg: var(--app-bg);
  --page-card: var(--app-surface);
  --page-card-soft: var(--app-surface-muted);
  --page-border: var(--app-border);
  --page-border-strong: var(--app-border-strong);
  --page-text: var(--app-text);
  --page-text-soft: var(--app-text-muted);
  --page-accent: var(--app-primary);
  --page-accent-soft: var(--app-primary-soft);
  --page-success: var(--app-success);
  --page-success-soft: var(--app-success-soft);
  --page-danger: var(--app-danger);
  --page-danger-soft: var(--app-danger-soft);
  --page-warning: var(--app-warning);
  --page-warning-soft: var(--app-warning-soft);
  --page-shadow: var(--app-shadow-subtle);
}

.institution-app {
  display: grid;
  gap: 24px;
}

.institution-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.bootstrap-workflow .app-sidebar {
  display: none;
}

.bootstrap-workflow .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.bootstrap-workflow .app-main-inner {
  width: min(1320px, calc(100vw - 64px));
  max-width: none;
  padding-top: 32px;
}

.bootstrap-workflow .institution-workspace {
  grid-template-columns: minmax(0, 1fr) 308px;
  align-items: start;
  gap: 20px;
}

.bootstrap-workflow .institution-app {
  gap: 20px;
}

.bootstrap-workflow .institution-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: stretch;
  padding: 28px 30px;
  border: 1px solid rgba(219, 229, 242, 0.92);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(87, 108, 228, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%);
  box-shadow: var(--page-shadow);
}

.bootstrap-workflow .institution-hero__meta {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(219, 229, 242, 0.9);
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.86);
}

.bootstrap-workflow .institution-hero__meta .topbar-stats {
  gap: 8px;
}

.bootstrap-workflow .institution-hero__meta .summary-pill {
  background: rgba(255, 255, 255, 0.78);
}

.bootstrap-workflow #saveBtn {
  display: none;
}

.bootstrap-workflow #employeeAccessCard,
.bootstrap-workflow #adminInviteCard {
  display: none !important;
}

.workflow-rail {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 24px;
}

.workflow-rail__card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--page-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--page-shadow);
}

.bootstrap-workflow .workflow-rail {
  top: 32px;
  gap: 14px;
}

.bootstrap-workflow .workflow-rail__card {
  padding: 20px;
  border-radius: 22px;
}

.workflow-rail__card h2,
.workflow-rail__card h3 {
  margin: 0;
  color: var(--page-text);
  line-height: 1.15;
}

.workflow-rail__card p {
  margin: 0;
  color: var(--page-text-soft);
  font-size: 14px;
  line-height: 1.55;
}

.workflow-rail__card--muted {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.88) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.workflow-rail__list {
  display: grid;
  gap: 10px;
}

.workflow-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--page-border);
  border-radius: 16px;
  background: #fbfdff;
  text-align: left;
  cursor: pointer;
}

.bootstrap-workflow .workflow-step-card {
  padding: 15px 16px;
  border-radius: 18px;
  background: #fff;
}

.workflow-step-card strong {
  display: block;
  margin: 0 0 4px;
  color: var(--page-text);
  font-size: 14px;
}

.workflow-step-card p {
  margin: 0;
  color: var(--page-text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.workflow-step-card:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.workflow-step-card.is-current {
  border-color: rgba(87, 108, 228, 0.32);
  background: #eef4ff;
}

.workflow-step-card.is-complete {
  border-color: rgba(60, 138, 96, 0.22);
  background: #f4fbf7;
}

.workflow-step-card__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--page-border);
  background: #fff;
  color: var(--page-text);
  font-size: 13px;
  font-weight: 700;
}

.workflow-step-card.is-current .workflow-step-card__index {
  border-color: rgba(87, 108, 228, 0.2);
  background: rgba(87, 108, 228, 0.1);
  color: var(--page-accent);
}

.workflow-step-card.is-complete .workflow-step-card__index {
  border-color: rgba(60, 138, 96, 0.18);
  background: rgba(60, 138, 96, 0.1);
  color: var(--page-success);
}

.institution-page .topbar {
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.bootstrap-workflow .topbar {
  margin-bottom: 0;
}

.institution-page .title-block h1 {
  margin-bottom: 0;
  color: var(--page-text);
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.institution-page .title-block p {
  color: var(--page-text-soft);
  max-width: 640px;
  font-size: 15px;
  line-height: 1.6;
}

.institution-page .title-block {
  gap: 8px;
}

.institution-page button {
  border-color: var(--page-border-strong);
  background: var(--page-card);
  color: var(--page-text);
  font-weight: 600;
  box-shadow: none;
}

.institution-page button:hover:not(:disabled) {
  border-color: #adc3e3;
  background: #fbfdff;
}

.institution-overview-card {
  display: grid;
  gap: 24px;
  padding: 26px 28px;
  border: 1px solid rgba(219, 229, 242, 0.96);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(87, 108, 228, 0.09), transparent 32%),
    linear-gradient(180deg, rgba(247, 250, 255, 0.98) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow: 0 18px 42px rgba(148, 163, 184, 0.12);
}

.institution-overview-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.institution-overview-card__head > div:first-child {
  max-width: 760px;
}

.institution-overview-card__head h3 {
  margin: 0;
  font-size: 28px;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.institution-overview-card__head p {
  margin: 10px 0 0;
  color: var(--page-text-soft);
  font-size: 15px;
  line-height: 1.6;
}

.institution-overview-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

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

.institution-overview-item {
  display: grid;
  align-content: start;
  gap: 10px;
  text-align: left;
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid rgba(210, 222, 237, 0.92);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.institution-overview-item--actionable {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.institution-overview-item--actionable:hover {
  transform: translateY(-1px);
  border-color: rgba(87, 108, 228, 0.28);
  background: rgba(248, 251, 255, 0.98);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.84),
    0 12px 26px rgba(148, 163, 184, 0.12);
}

.institution-overview-item--actionable:focus-visible {
  outline: none;
  border-color: rgba(87, 108, 228, 0.36);
  box-shadow:
    0 0 0 4px rgba(87, 108, 228, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.institution-overview-item--wide {
  grid-column: span 1;
}

.institution-overview-item__label {
  color: #7082a0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.institution-overview-item strong {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--page-text);
  text-wrap: pretty;
}

.institution-page button.primary {
  border-color: transparent;
  background: var(--page-accent);
  color: #fff;
}

.institution-page button.primary:hover:not(:disabled) {
  background: var(--app-primary-strong);
}

.institution-page button.soft {
  background: #f4f8ff;
}

.institution-page button.danger {
  border-color: rgba(192, 86, 102, 0.2);
  background: transparent;
  color: var(--page-danger);
}

.institution-page button.danger:hover:not(:disabled) {
  background: var(--page-danger-soft);
  border-color: rgba(192, 86, 102, 0.28);
}

.institution-layout {
  display: grid;
  gap: 24px;
}

.bootstrap-workflow .institution-layout {
  gap: 20px;
}

.institution-page .actions {
  position: relative;
  z-index: 1;
  align-self: center;
  align-items: center;
  gap: 12px;
}

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

.institution-page .panel {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(219, 229, 242, 0.92);
  box-shadow: var(--page-shadow);
}

.bootstrap-workflow .panel {
  border-radius: 24px;
  overflow: hidden;
}

.institution-page .panel-body {
  padding: 22px 24px 24px;
}

.bootstrap-workflow .panel-body {
  padding: 20px 22px 22px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid rgba(219, 229, 242, 0.9);
}

.section-head h2 {
  margin: 0 0 4px;
  color: var(--page-text);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--page-text-soft);
  font-size: 14px;
  line-height: 1.45;
}

.bootstrap-workflow .section-head {
  padding: 20px 22px 12px;
}

.bootstrap-workflow .section-head h2 {
  font-size: 21px;
}

.section-kicker {
  margin-bottom: 8px;
  color: #7d8dab;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head-structure {
  align-items: flex-end;
}

.section-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.section-summary-structure {
  align-items: center;
}

.section-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.summary-pill,
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--page-border);
  border-radius: 999px;
  background: #f7faff;
  color: #50637f;
  font-size: 12px;
  line-height: 1;
}

.summary-pill strong {
  color: var(--page-text);
}

.institution-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--page-border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.bootstrap-workflow .institution-card,
.bootstrap-workflow .employee-access-card {
  padding: 18px;
  border-radius: 18px;
}

.institution-card__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.institution-card--compact-editor .institution-card__summary {
  display: none;
}

.institution-card--compact-editor .institution-card__editor {
  gap: 22px;
  padding: 4px 2px 2px;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.workflow-actions--panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(219, 229, 242, 0.92);
}

.summary-pair-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-pair {
  padding: 14px 16px;
  border: 1px solid var(--page-border);
  border-radius: 16px;
  background: var(--page-card-soft);
}

.summary-label {
  display: block;
  margin-bottom: 7px;
  color: #7a8ca7;
  font-size: 12px;
  font-weight: 600;
}

.summary-pair strong {
  color: var(--page-text);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.4;
}

.employee-access-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--page-border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.panel--compact .panel-body {
  padding-top: 6px;
}

.employee-access-card--compact {
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
}

.employee-access-card--compact .employee-access-card__head h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.employee-access-card--compact .employee-access-card__head p {
  font-size: 13px;
  line-height: 1.4;
}

.employee-access-card--compact .employee-access-grid {
  grid-template-columns: repeat(2, minmax(180px, 260px));
}

.employee-access-card--compact .summary-pair {
  padding: 12px 14px;
}

.employee-access-card--compact .employee-access-status {
  padding: 10px 12px;
  font-size: 13px;
}

.employee-access-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.employee-access-card__head h3 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.employee-access-card__head p {
  margin: 0;
  max-width: 560px;
  color: var(--page-text-soft);
  font-size: 14px;
  line-height: 1.45;
}

.positions-card--collapsed {
  padding-bottom: 18px;
}

.positions-card--collapsed .employee-access-card__head {
  align-items: center;
}

.positions-card--collapsed #positionsStatus,
.positions-card--collapsed .positions-layout {
  display: none;
}

.positions-card--collapsed .employee-access-card__head h3 {
  margin-bottom: 2px;
}

.positions-card--collapsed .employee-access-card__head p {
  max-width: none;
  font-size: 13px;
}

.structure-panel--collapsed .section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 0;
}

.structure-panel--collapsed .panel-body {
  display: none;
}

.structure-panel--collapsed .section-head > div:first-child {
  flex: 1;
  min-width: 0;
}

.structure-panel--collapsed .section-head h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.structure-panel--collapsed .section-head p {
  max-width: none;
  font-size: 13px;
  line-height: 1.45;
}

.structure-panel--collapsed .section-summary {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.structure-panel--collapsed .section-summary__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.structure-panel--collapsed .section-summary__actions button + button {
  display: none;
}

.structure-panel--collapsed #structureApprovalBadge {
  white-space: nowrap;
}

.employee-access-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

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

.employee-access-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 14px;
}

.employee-access-status {
  padding: 12px 14px;
  border: 1px solid var(--page-border);
  border-radius: 14px;
  background: #f7faff;
  color: var(--page-text-soft);
  font-size: 14px;
  line-height: 1.45;
}

.employee-access-status.ready {
  border-color: rgba(47, 133, 90, 0.18);
  background: rgba(47, 133, 90, 0.06);
  color: #2b694a;
}

.employee-access-status.pending {
  border-color: rgba(245, 166, 35, 0.22);
  background: rgba(245, 166, 35, 0.08);
  color: #8a5b00;
}

.employee-access-link {
  display: inline-block;
  color: var(--page-accent);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.employee-access-link:hover {
  text-decoration: underline;
}

.employee-invite-latest {
  display: grid;
  gap: 12px;
}

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

.employee-invite-item {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--page-border);
  border-radius: 16px;
  background: #fbfdff;
}

.employee-invite-item__head,
.employee-invite-item__meta,
.employee-invite-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.employee-invite-item__title {
  font-size: 15px;
  font-weight: 700;
}

.employee-invite-item__link {
  color: var(--page-accent);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
}

.employee-invite-item__meta {
  justify-content: flex-start;
}

.positions-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.positions-section {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.positions-groups {
  display: grid;
  gap: 14px;
}

.positions-group {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--page-border);
  border-radius: 16px;
  background: #fbfdff;
}

.positions-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.positions-group__head strong {
  color: var(--page-text);
  font-size: 15px;
}

.positions-group__meta {
  color: var(--page-text-soft);
  font-size: 13px;
}

.positions-row-list,
.positions-custom-list {
  display: grid;
  gap: 8px;
}

.institution-page .position-row,
.institution-page .position-line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(219, 229, 242, 0.8);
}

.institution-page .position-row:last-child,
.institution-page .position-line-item:last-child {
  border-bottom: 0;
}

.institution-page .position-row__label,
.institution-page .position-line-item__title {
  color: var(--page-text);
  font-size: 12px;
  line-height: 1.25;
}

.institution-page .position-line-item__body {
  display: grid;
  gap: 2px;
}

.institution-page .position-line-item__meta {
  color: var(--page-text-soft);
  font-size: 10px;
}

.institution-page .position-row__action {
  flex: 0 0 auto;
  width: 14px !important;
  min-width: 14px !important;
  max-width: 14px !important;
  height: 14px !important;
  min-height: 14px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px;
  background: rgba(212, 75, 75, 0.18);
  color: #d63b3b;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 0 0 rgba(207, 63, 63, 0);
  transition: color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.institution-page .position-row__action:hover:not(:disabled) {
  color: #fff4f4;
  background: rgba(207, 63, 63, 0.92);
  box-shadow: 0 0 8px rgba(207, 63, 63, 0.45);
  transform: scale(1.08);
}

.institution-page .position-row__action--danger {
  color: #bf3f3f;
}

.institution-page .position-row__action--restore {
  color: #3c7a56;
  font-size: 9px;
}

.institution-page .position-row__action--restore:hover:not(:disabled) {
  color: #21603a;
  background: rgba(47, 133, 90, 0.08);
}

.position-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.position-create-form > button,
.position-create-form > .primary {
  justify-self: start;
  align-self: start;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
}

.structure-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--page-border);
  border-radius: 18px;
  background: var(--page-card-soft);
}

.structure-mode-toggle .subsection-head {
  min-width: 0;
}

.structure-mode-toggle .subsection-head span {
  max-width: 520px;
}

.institution-card__editor {
  display: grid;
  gap: 18px;
  padding-top: 4px;
}

.institution-card--compact-editor .editor-grid-main {
  gap: 16px;
}

.institution-card--compact-editor .field {
  display: grid;
  gap: 8px;
}

.institution-card--compact-editor label {
  color: #7284a0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.institution-card--compact-editor input {
  min-height: 56px;
  padding: 14px 16px;
  border-color: rgba(210, 222, 237, 0.96);
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.institution-card--compact-editor #toggleInstitutionExtraBtn {
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--page-border-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--page-text);
}

.institution-card--compact-editor #toggleInstitutionExtraBtn:hover:not(:disabled) {
  background: #fbfdff;
  color: var(--page-text);
}

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

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

.editor-grid-extra {
  grid-template-columns: minmax(0, 280px);
}

.institution-page label {
  color: #5f7090;
  font-weight: 600;
}

.institution-page input,
.institution-page select,
.institution-page textarea {
  border-color: var(--page-border-strong);
  background: #fff;
  color: var(--page-text);
  font-size: 15px;
  font-weight: 500;
}

.institution-page input::placeholder,
.institution-page textarea::placeholder {
  color: #98a7bf;
}

.institution-page input:focus,
.institution-page select:focus,
.institution-page textarea:focus {
  border-color: rgba(63, 124, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(63, 124, 255, 0.12);
}

.details-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-btn,
.reveal-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--page-accent);
  font-weight: 600;
}

.text-btn:hover:not(:disabled),
.reveal-btn:hover:not(:disabled) {
  transform: none;
  background: transparent;
  color: #2d68e4;
}

.institution-extra,
.branch-extra,
.department-extra {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px dashed var(--page-border-strong);
  border-radius: 18px;
  background: #f8fbff;
}

.subsection {
  display: grid;
  gap: 12px;
}

.subsection-head {
  display: grid;
  gap: 4px;
}

.subsection-head strong {
  color: var(--page-text);
  font-size: 14px;
}

.subsection-head span {
  color: var(--page-text-soft);
  font-size: 13px;
  line-height: 1.45;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid rgba(210, 222, 237, 0.96);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.mode-chip {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #556986;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.mode-chip.active {
  border-color: transparent;
  background: rgba(63, 124, 255, 0.12);
  color: var(--page-accent);
  box-shadow: inset 0 0 0 1px rgba(63, 124, 255, 0.18);
}

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

.status-box {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #dce6f3;
  border-radius: 16px;
  background: #f7faff;
  color: #50637f;
  font-size: 13px;
  line-height: 1.5;
}

.status-box.invalid {
  border-color: rgba(192, 86, 102, 0.2);
  background: rgba(192, 86, 102, 0.06);
  color: #8b4450;
}

.status-box.valid {
  border-color: rgba(47, 133, 90, 0.18);
  background: rgba(47, 133, 90, 0.08);
  color: #2b6c4d;
}

.branch-list {
  display: grid;
  gap: 16px;
}

.single-structure-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--page-border);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.single-structure-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.single-structure-card__head h3 {
  margin: 0 0 6px;
  color: var(--page-text);
  font-size: 20px;
  line-height: 1.2;
}

.single-structure-card__head p {
  margin: 0;
  color: var(--page-text-soft);
  font-size: 14px;
  line-height: 1.5;
  max-width: 560px;
}

.single-structure-card__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.single-structure-card__actions {
  display: flex;
  justify-content: flex-start;
}

.branch-card__footer-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 16px;
  border-top: 1px solid rgba(219, 229, 242, 0.9);
}

.departments-block--single {
  padding: 18px;
  border: 1px solid var(--page-border);
  border-radius: 18px;
  background: var(--page-card-soft);
}

.structure-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(219, 229, 242, 0.9);
}

#structureDraftStatus {
  margin-top: 12px;
}

.branch-card {
  border: 1px solid var(--page-border);
  border-radius: 20px;
  background: #fff;
}

.branch-card__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.branch-card__main {
  min-width: 0;
  flex: 1;
}

.branch-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.branch-card__title-row h3 {
  margin: 0;
  color: var(--page-text);
  font-size: 18px;
  line-height: 1.25;
}

.branch-card__meta,
.department-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--page-text-soft);
  font-size: 13px;
}

.branch-card__side,
.department-item__side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.status-pill.active {
  background: var(--page-success-soft);
  color: var(--page-success);
}

.status-pill.inactive {
  background: var(--page-danger-soft);
  color: var(--page-danger);
}

.branch-card__details {
  display: grid;
  gap: 18px;
  padding: 0 20px 20px;
  border-top: 1px solid rgba(219, 229, 242, 0.88);
}

.branch-card__details[hidden] {
  display: none !important;
}

.branch-note {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f7faff;
  color: var(--page-text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.branch-editor-grid {
  padding-top: 18px;
}

.branch-detail-actions,
.department-detail-actions {
  padding-top: 2px;
}

.departments-block {
  display: grid;
  gap: 14px;
  padding: 16px 0 0;
}

.departments-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.departments-head strong {
  display: block;
  margin-bottom: 4px;
  color: var(--page-text);
  font-size: 15px;
}

.departments-head p {
  margin: 0;
  color: var(--page-text-soft);
  font-size: 13px;
  line-height: 1.45;
}

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

.department-item {
  border: 1px solid var(--page-border);
  border-radius: 16px;
  background: #fbfdff;
}

.department-item__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.department-item__main {
  min-width: 0;
  flex: 1;
}

.department-name-view {
  display: block;
  margin-bottom: 6px;
  color: var(--page-text);
  font-size: 15px;
  line-height: 1.35;
}

.department-item__details {
  display: grid;
  gap: 16px;
  padding: 0 16px 16px;
  border-top: 1px solid rgba(219, 229, 242, 0.88);
}

.institution-page [hidden] {
  display: none !important;
}

.department-editor-grid {
  padding-top: 16px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty {
  padding: 22px 18px;
  border: 1px dashed var(--page-border-strong);
  border-radius: 18px;
  background: #fafcff;
  color: var(--page-text-soft);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.empty--action {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 22px 18px;
  background: #fafcff;
  color: var(--page-text-soft);
}

.empty--action:hover {
  border-color: #b7c8e5;
  background: #f4f8ff;
  color: var(--page-text);
}

.empty--action:focus-visible {
  box-shadow: 0 0 0 4px rgba(87, 108, 228, 0.12);
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: rgba(192, 86, 102, 0.42);
  box-shadow: 0 0 0 4px rgba(192, 86, 102, 0.08);
}

.field-errors {
  color: var(--page-danger);
}

.hint,
.meta {
  color: var(--page-text-soft);
}

@media (max-width: 980px) {
  .bootstrap-workflow .app-main-inner {
    width: min(100%, calc(100vw - 32px));
    padding-top: 20px;
  }

  .bootstrap-workflow .institution-workspace {
    grid-template-columns: 1fr;
  }

  .bootstrap-workflow .institution-hero {
    grid-template-columns: 1fr;
    padding: 22px;
    border-radius: 24px;
  }

  .institution-page .topbar {
    grid-template-columns: 1fr;
    padding: 0;
    border-radius: 0;
  }

  .editor-grid-main,
  .editor-grid,
  .section-head,
  .single-structure-card__head,
  .institution-card__summary,
  .branch-card__summary,
  .department-item__summary,
  .departments-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .summary-pair-grid {
    grid-template-columns: 1fr;
  }

  .employee-access-card__head,
  .single-structure-card__meta,
  .employee-access-grid,
  .positions-layout,
  .position-create-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .institution-overview-card__head {
    flex-direction: column;
    align-items: stretch;
  }

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

  .institution-overview-item--wide {
    grid-column: span 2;
  }

  .structure-mode-toggle {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-switch--toggle {
    width: 100%;
    justify-content: stretch;
  }

  .mode-switch--toggle .mode-chip {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
  }

  .branch-card__side,
  .department-item__side,
  .section-summary {
    justify-content: flex-start;
  }

  .structure-footer-actions {
    justify-content: flex-start;
  }

  .institution-page .actions {
    justify-content: flex-start;
  }
}

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

  .bootstrap-workflow .app-main-inner {
    width: min(100%, calc(100vw - 20px));
    padding-top: 12px;
  }

  .institution-page .topbar {
    margin-bottom: 18px;
    padding: 18px;
    border-radius: 22px;
  }

  .institution-page .title-block h1 {
    font-size: 34px;
  }

  .institution-page .title-block p {
    font-size: 15px;
  }

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

  .institution-overview-item--wide {
    grid-column: span 1;
  }

  .section-head,
  .institution-page .panel-body,
  .branch-card__summary,
  .branch-card__details,
  .department-item__summary,
  .department-item__details,
  .workflow-step-card {
    padding-left: 16px;
    padding-right: 16px;
  }
}
